package com.zhumei.keyscale.weight;

import android.app.*;
import android.content.*;
import android_serialport_api.*;
import java.text.*;
import com.blankj.utilcode.util.*;
import android.util.*;
import java.io.*;
import io.reactivex.*;
import io.reactivex.android.schedulers.*;

public class SerialPortUtil
{
    public static SerialPortUtil serialPortUtil;
    private Activity activity;
    private CaliBrationInterface caliBrationInterface;
    public Context context;
    int deviceStyle;
    private InputStream inputStream;
    private boolean isStart;
    private KeyboardInterface keyboardInterface;
    private KeyboardToolsInterface keyboardToolsInterface;
    private KeyboardsInterface keyboardsInterface;
    private ReceiveThread mReceiveThread;
    private OutputStream outputStream;
    private SerialPort serialPort;
    private WeightInterface weightInterface;
    
    public SerialPortUtil() {
        this.deviceStyle = 0;
        this.serialPort = null;
        this.inputStream = null;
        this.outputStream = null;
        this.mReceiveThread = null;
        this.isStart = false;
        this.context = this.context;
        this.getSerialPort();
        this.inputStream = this.serialPort.getInputStream();
        this.outputStream = this.serialPort.getOutputStream();
        this.isStart = true;
        this.sendSerialPort(new byte[] { 22 });
        this.startThread();
    }
    
    public SerialPortUtil(final String s, final int n) {
        this.deviceStyle = 0;
        this.serialPort = null;
        this.inputStream = null;
        this.outputStream = null;
        this.mReceiveThread = null;
        this.isStart = false;
        this.context = this.context;
        this.getSerialPort(s, n);
        this.inputStream = this.serialPort.getInputStream();
        this.outputStream = this.serialPort.getOutputStream();
        this.isStart = true;
        this.startThread();
    }
    
    public static SerialPortUtil getSerialPortUtil() {
        if (SerialPortUtil.serialPortUtil == null) {
            SerialPortUtil.serialPortUtil = new SerialPortUtil();
        }
        if (SerialPortUtil.serialPortUtil.mReceiveThread == null) {
            SerialPortUtil.serialPortUtil = new SerialPortUtil();
        }
        if (!SerialPortUtil.serialPortUtil.mReceiveThread.isAlive()) {
            SerialPortUtil.serialPortUtil.mReceiveThread.start();
        }
        return SerialPortUtil.serialPortUtil;
    }
    
    public static void init(final Context context) {
        (SerialPortUtil.serialPortUtil = new SerialPortUtil()).setContext(context);
    }
    
    public static void init(final Context context, final String s, final int n) {
        (SerialPortUtil.serialPortUtil = new SerialPortUtil(s, n)).setContext(context);
    }
    
    private void startThread() {
        if (this.mReceiveThread == null) {
            this.mReceiveThread = new ReceiveThread();
        }
        this.mReceiveThread.start();
    }
    
    public void analysisDataNew(final String s) {
        final int index = s.indexOf("DE16F8");
        int i = 0;
        if (index == 0 && s.length() >= 42) {
            if (this.weightInterface == null) {
                return;
            }
            final String replace = s.replace("DE16F8", "");
            if (replace.length() >= 24) {
                final String substring = replace.substring(0, 2);
                final String substring2 = replace.substring(2, 4);
                final String substring3 = replace.substring(4, 6);
                final String substring4 = replace.substring(6, 8);
                final String substring5 = replace.substring(8, 10);
                final double double1 = Double.parseDouble(substring4);
                final double double2 = Double.parseDouble(substring3);
                final double double3 = Double.parseDouble(substring2);
                final double double4 = Double.parseDouble(substring);
                final int int1 = Integer.parseInt(substring5);
                String string = "";
                double n = double1 * 1000000.0 + double2 * 10000.0 + double3 * 100.0 + double4;
                while (i < int1) {
                    n /= 10.0;
                    final StringBuilder sb = new StringBuilder();
                    sb.append(string);
                    sb.append("0");
                    string = sb.toString();
                    ++i;
                }
                final StringBuilder sb2 = new StringBuilder();
                sb2.append("######0.");
                sb2.append(string);
                final DecimalFormat decimalFormat = new DecimalFormat(sb2.toString());
                final String format = decimalFormat.format(n);
                double n2 = Double.parseDouble(replace.substring(18, 20)) * 1000000.0 + Double.parseDouble(replace.substring(16, 18)) * 10000.0 + Double.parseDouble(replace.substring(14, 16)) * 100.0 + Double.parseDouble(replace.substring(12, 14));
                for (int j = 0; j < int1; ++j) {
                    n2 /= 10.0;
                }
                this.weightInterface.skinWeight(decimalFormat.format(n2));
                final String substring6 = replace.substring(20, 22);
                final String substring7 = replace.substring(22, 24);
                final String substring8 = replace.substring(24, 26);
                final int int2 = Integer.parseInt(replace.substring(26, 28));
                final int int3 = Integer.parseInt(substring8);
                final int int4 = Integer.parseInt(substring7);
                final int int5 = Integer.parseInt(substring6);
                final WeightInterface weightInterface = this.weightInterface;
                final StringBuilder sb3 = new StringBuilder();
                sb3.append(int2 * 1000000 + int3 * 10000 + int4 * 100 + int5);
                sb3.append("");
                weightInterface.start_ad(sb3.toString());
                final String substring9 = replace.substring(28, 30);
                final String substring10 = replace.substring(30, 32);
                final String substring11 = replace.substring(32, 34);
                final int int6 = Integer.parseInt(replace.substring(34, 36));
                final int int7 = Integer.parseInt(substring11);
                final int int8 = Integer.parseInt(substring10);
                final int int9 = Integer.parseInt(substring9);
                final WeightInterface weightInterface2 = this.weightInterface;
                final StringBuilder sb4 = new StringBuilder();
                sb4.append(int6 * 1000000 + int7 * 10000 + int8 * 100 + int9);
                sb4.append("");
                weightInterface2.skinWeight_ad(sb4.toString());
                final String substring12 = replace.substring(36, 38);
                final String substring13 = replace.substring(38, 40);
                final String substring14 = replace.substring(40, 42);
                final int int10 = Integer.parseInt(replace.substring(42, 44));
                final int int11 = Integer.parseInt(substring14);
                final int int12 = Integer.parseInt(substring13);
                final int int13 = Integer.parseInt(substring12);
                final WeightInterface weightInterface3 = this.weightInterface;
                final StringBuilder sb5 = new StringBuilder();
                sb5.append(int10 * 1000000 + int11 * 10000 + int12 * 100 + int13);
                sb5.append("");
                weightInterface3.curent_ad(sb5.toString());
                final int int14 = Integer.parseInt(replace.substring(10, 12), 16);
                String string2 = "";
                for (int k = 7; k >= 0; --k) {
                    final StringBuilder sb6 = new StringBuilder();
                    sb6.append(string2);
                    sb6.append(int14 >> k & 0x1);
                    string2 = sb6.toString();
                }
                if (string2.length() == 8) {
                    final String substring15 = string2.substring(7, 8);
                    final String s2 = "1";
                    if (s2.equals(substring15)) {
                        this.weightInterface.stabilityWeight(1);
                    }
                    else {
                        this.weightInterface.stabilityWeight(0);
                    }
                    if (s2.equals(string2.substring(6, 7))) {
                        this.weightInterface.overload(1);
                    }
                    else {
                        this.weightInterface.overload(0);
                    }
                    if (s2.equals(string2.substring(5, 6))) {
                        this.weightInterface.loadBearing(1);
                        final WeightInterface weightInterface4 = this.weightInterface;
                        final StringBuilder sb7 = new StringBuilder();
                        sb7.append("-");
                        sb7.append(format);
                        weightInterface4.weight(sb7.toString());
                    }
                    else {
                        this.weightInterface.loadBearing(0);
                        this.weightInterface.weight(format);
                    }
                    if (s2.equals(string2.substring(4, 5))) {
                        this.weightInterface.peel(1);
                    }
                    else {
                        this.weightInterface.peel(0);
                    }
                    if (s2.equals(string2.substring(3, 4))) {
                        this.weightInterface.zeroPosition(1);
                    }
                    else {
                        this.weightInterface.zeroPosition(0);
                    }
                    if (s2.equals(string2.substring(2, 3))) {
                        this.weightInterface.error(1);
                    }
                    else {
                        this.weightInterface.error(0);
                    }
                    if (s2.equals(string2.substring(1, 2))) {
                        this.weightInterface.range(1);
                    }
                    else {
                        this.weightInterface.range(0);
                    }
                }
            }
        }
        if (s.equals("DE02E001003DDF")) {
            final CaliBrationInterface caliBrationInterface = this.caliBrationInterface;
            if (caliBrationInterface != null) {
                caliBrationInterface.start_step(0);
            }
        }
        else if (s.equals("DE02E000003CDF")) {
            final CaliBrationInterface caliBrationInterface2 = this.caliBrationInterface;
            if (caliBrationInterface2 != null) {
                caliBrationInterface2.start_step(1);
            }
        }
        else if (s.equals("DE02E006003ADF")) {
            final CaliBrationInterface caliBrationInterface3 = this.caliBrationInterface;
            if (caliBrationInterface3 != null) {
                caliBrationInterface3.start_step(2);
            }
        }
        else if (s.equals("DE02E000003CDF")) {
            final CaliBrationInterface caliBrationInterface4 = this.caliBrationInterface;
            if (caliBrationInterface4 != null) {
                caliBrationInterface4.start_step(3);
            }
        }
        else if (s.equals("DE02E002003EDF")) {
            final CaliBrationInterface caliBrationInterface5 = this.caliBrationInterface;
            if (caliBrationInterface5 != null) {
                caliBrationInterface5.start_step(4);
            }
        }
        else if (s.equals("DE02E003003FDF")) {
            final CaliBrationInterface caliBrationInterface6 = this.caliBrationInterface;
            if (caliBrationInterface6 != null) {
                caliBrationInterface6.start_step(5);
            }
        }
        else if (s.indexOf("DE10E004") == 0) {
            final CaliBrationInterface caliBrationInterface7 = this.caliBrationInterface;
            if (caliBrationInterface7 != null) {
                caliBrationInterface7.start_step(7);
            }
        }
        else if (s.equals("7E02E90000957F")) {
            final CaliBrationInterface caliBrationInterface8 = this.caliBrationInterface;
            if (caliBrationInterface8 != null) {
                caliBrationInterface8.start_step(11);
            }
        }
        else if (s.equals("DE02E003003FDF")) {
            final CaliBrationInterface caliBrationInterface9 = this.caliBrationInterface;
            if (caliBrationInterface9 != null) {
                caliBrationInterface9.start_step(12);
            }
        }
        if (s.length() >= 24) {
            final String substring16 = s.substring(18, 20);
            if (s.indexOf("DE07EB") == 0 && substring16.equals("DC")) {
                final int int15 = Integer.parseInt(s.replace("DE07EB", "").substring(10, 12), 16);
                final KeyboardInterface keyboardInterface = this.keyboardInterface;
                if (keyboardInterface != null) {
                    int n3;
                    if (int15 >= 16 && int15 <= 26) {
                        n3 = int15 - 15;
                    }
                    else if (int15 >= 32 && int15 <= 42) {
                        n3 = int15 - 20;
                    }
                    else if (int15 >= 48 && int15 <= 58) {
                        n3 = int15 - 25;
                    }
                    else if (int15 >= 64 && int15 <= 74) {
                        n3 = int15 - 30;
                    }
                    else if (int15 >= 80 && int15 <= 90) {
                        n3 = int15 - 35;
                    }
                    else if (int15 >= 96 && int15 <= 106) {
                        n3 = int15 - 40;
                    }
                    else if (int15 >= 112 && int15 <= 122) {
                        n3 = int15 - 45;
                    }
                    else {
                        n3 = 0;
                    }
                    if (n3 > 0) {
                        keyboardInterface.numberleans(n3);
                        return;
                    }
                }
                if (keyboardInterface != null) {
                    String s3;
                    if (int15 == 123) {
                        s3 = "0";
                    }
                    else if (int15 == 124) {
                        s3 = "00";
                    }
                    else if (int15 == 107) {
                        s3 = "1";
                    }
                    else if (int15 == 108) {
                        s3 = "2";
                    }
                    else if (int15 == 109) {
                        s3 = "3";
                    }
                    else if (int15 == 91) {
                        s3 = "4";
                    }
                    else if (int15 == 92) {
                        s3 = "5";
                    }
                    else if (int15 == 93) {
                        s3 = "6";
                    }
                    else if (int15 == 75) {
                        s3 = "7";
                    }
                    else if (int15 == 76) {
                        s3 = "8";
                    }
                    else if (int15 == 77) {
                        s3 = "9";
                    }
                    else {
                        s3 = "";
                    }
                    if (s3 != null && !s3.equals("")) {
                        this.keyboardInterface.number(s3);
                        return;
                    }
                }
                if (int15 == 61) {
                    this.sendSerialPort(Cmd.OPEN_MANY);
                }
                else if (int15 == 62) {
                    this.sendSerialPort(Cmd.OPEN_MANY);
                }
                final KeyboardToolsInterface keyboardToolsInterface = this.keyboardToolsInterface;
                if (keyboardToolsInterface != null) {
                    if (int15 == 27) {
                        keyboardToolsInterface.turnPage();
                    }
                    else if (int15 == 28) {
                        keyboardToolsInterface.pluOrUp();
                    }
                    else if (int15 == 29) {
                        keyboardToolsInterface.setOrReturn();
                    }
                    else if (int15 == 30) {
                        keyboardToolsInterface.repeatPrint();
                    }
                    else if (int15 == 43) {
                        keyboardToolsInterface.paperOrLeft();
                    }
                    else if (int15 == 44) {
                        keyboardToolsInterface.timeOrDown();
                    }
                    else if (int15 == 45) {
                        keyboardToolsInterface.lockPriceOrRight();
                    }
                    else if (int15 == 46) {
                        keyboardToolsInterface.priceUpdata();
                    }
                    else if (int15 == 59) {
                        keyboardToolsInterface.communicationOrPassword();
                    }
                    else if (int15 == 60) {
                        keyboardToolsInterface.discount();
                    }
                    else if (int15 == 61) {
                        keyboardToolsInterface.peel();
                        this.sendSerialPort(Cmd.OPEN_MANY);
                    }
                    else if (int15 == 62) {
                        keyboardToolsInterface.zeroSetting();
                        this.sendSerialPort(Cmd.OPEN_MANY);
                    }
                    else if (int15 == 78) {
                        keyboardToolsInterface.X();
                    }
                    else if (int15 == 94) {
                        keyboardToolsInterface.cancel();
                    }
                    else if (int15 == 110) {
                        keyboardToolsInterface.automaticPrint();
                    }
                    else if (int15 == 125) {
                        keyboardToolsInterface.print();
                    }
                    else if (int15 == 126) {
                        keyboardToolsInterface.confirm();
                    }
                }
            }
        }
        if (s.indexOf("DE04EB") == 0) {
            System.out.println(s);
            final StringBuilder sb8 = new StringBuilder();
            sb8.append("\u952e\u76d8\u6570\u636e --> ");
            sb8.append(s);
            LogUtils.d(sb8.toString());
        }
        if (this.keyboardsInterface != null && s.indexOf("DE04EB") == 0) {
            if (s.equals("DE04EB0100000131DF")) {
                this.keyboardsInterface.vaues("\u4f1a\u5458\u5361");
                return;
            }
            if (s.equals("DE04EB0100000232DF")) {
                this.keyboardsInterface.vaues("\u6570\u5b57\u4eba\u6c11\u5e01");
                return;
            }
            if (s.equals("DE04EB0100000434DF")) {
                this.keyboardsInterface.vaues("\u652f\u4ed8\u5b9d");
                return;
            }
            if (s.equals("DE04EB0100000838DF")) {
                this.keyboardsInterface.vaues("\u73b0\u91d1");
                return;
            }
            if (s.equals("DE04EB0100001020DF")) {
                this.keyboardsInterface.vaues("\u786e\u8ba4");
                return;
            }
            if (s.equals("DE04EB0200000132DF")) {
                this.keyboardsInterface.vaues("0");
                return;
            }
            if (s.equals("DE04EB0200000231DF")) {
                this.keyboardsInterface.vaues("00");
                return;
            }
            if (s.equals("DE04EB0200000437DF")) {
                this.keyboardsInterface.vaues("\u53d6\u6d88");
                return;
            }
            if (s.equals("DE04EB020000083BDF")) {
                this.keyboardsInterface.vaues("\u6253\u5370");
                return;
            }
            if (s.equals("DE04EB0200001023DF")) {
                this.keyboardsInterface.vaues("\u7d2f\u8ba1");
                return;
            }
            if (s.equals("DE04EB0400000134DF")) {
                this.keyboardsInterface.vaues("1");
                return;
            }
            if (s.equals("DE04EB0400000237DF")) {
                this.keyboardsInterface.vaues("2");
                return;
            }
            if (s.equals("DE04EB0400000431DF")) {
                this.keyboardsInterface.vaues("3");
                return;
            }
            if (s.equals("DE04EB040000083DDF")) {
                this.keyboardsInterface.vaues("\u5176\u4ed6");
                return;
            }
            if (s.equals("DE04EB0400001025DF")) {
                this.keyboardsInterface.vaues("\u7d2f\u6e05");
                return;
            }
            if (s.equals("DE04EB4000000170DF")) {
                this.keyboardsInterface.vaues("4");
                return;
            }
            if (s.equals("DE04EB4000000273DF")) {
                this.keyboardsInterface.vaues("5");
                return;
            }
            if (s.equals("DE04EB4000000475DF")) {
                this.keyboardsInterface.vaues("6");
                return;
            }
            if (s.equals("DE04EB4000000879DF")) {
                this.keyboardsInterface.vaues("X");
                return;
            }
            if (s.equals("DE04EB4000001061DF")) {
                this.keyboardsInterface.vaues("\u7f6e\u96f6");
                return;
            }
            if (s.equals("DE04EB2000000110DF")) {
                this.keyboardsInterface.vaues("7");
                return;
            }
            if (s.equals("DE04EB2000000213DF")) {
                this.keyboardsInterface.vaues("8");
                return;
            }
            if (s.equals("DE04EB2000000415DF")) {
                this.keyboardsInterface.vaues("9");
                return;
            }
            if (s.equals("DE04EB2000000819DF")) {
                this.keyboardsInterface.vaues("\u8fd4\u56de");
                return;
            }
            if (s.equals("DE04EB2000001001DF")) {
                this.keyboardsInterface.vaues("\u53bb\u76ae");
                return;
            }
            if (s.equals("DE04EB1000000120DF")) {
                this.keyboardsInterface.vaues("+A");
                return;
            }
            if (s.equals("DE04EB1000000223DF")) {
                this.keyboardsInterface.vaues("+B");
                return;
            }
            if (s.equals("DE04EB1000000425DF")) {
                this.keyboardsInterface.vaues("+C");
                return;
            }
            if (s.equals("DE04EB1000000829DF")) {
                this.keyboardsInterface.vaues("+D");
                return;
            }
            if (s.equals("DE04EB1000001031DF")) {
                this.keyboardsInterface.vaues("\u8bbe\u7f6e");
                return;
            }
            if (s.equals("DE04EB10800000A1DF")) {
                this.keyboardsInterface.vaues("1");
                return;
            }
            if (s.equals("DE04EB1040000061DF")) {
                this.keyboardsInterface.vaues("2");
                return;
            }
            if (s.equals("DE04EB1020000001DF")) {
                this.keyboardsInterface.vaues("3");
                return;
            }
            if (s.equals("DE04EB1010000031DF")) {
                this.keyboardsInterface.vaues("4");
                return;
            }
            if (s.equals("DE04EB1000010020DF")) {
                this.keyboardsInterface.vaues("5");
                return;
            }
            if (s.equals("DE04EB1000020023DF")) {
                this.keyboardsInterface.vaues("6");
                return;
            }
            if (s.equals("DE04EB1000040025DF")) {
                this.keyboardsInterface.vaues("7");
                return;
            }
            if (s.equals("DE04EB1000080029DF")) {
                this.keyboardsInterface.vaues("8");
                return;
            }
            if (s.equals("DE04EB1000200001DF")) {
                this.keyboardsInterface.vaues("9");
                return;
            }
            if (s.equals("DE04EB2080000091DF")) {
                this.keyboardsInterface.vaues("10");
                return;
            }
            if (s.equals("DE04EB2040000051DF")) {
                this.keyboardsInterface.vaues("11");
                return;
            }
            if (s.equals("DE04EB2020000031DF")) {
                this.keyboardsInterface.vaues("a");
                return;
            }
            if (s.equals("DE04EB2010000001DF")) {
                this.keyboardsInterface.vaues("b");
                return;
            }
            if (s.equals("DE04EB2000010010DF")) {
                this.keyboardsInterface.vaues("c");
                return;
            }
            if (s.equals("DE04EB2000020013DF")) {
                this.keyboardsInterface.vaues("d");
                return;
            }
            if (s.equals("DE04EB2000040015DF")) {
                this.keyboardsInterface.vaues("e");
                return;
            }
            if (s.equals("DE04EB2000080019DF")) {
                this.keyboardsInterface.vaues("f");
                return;
            }
            if (s.equals("DE04EB2000200031DF")) {
                this.keyboardsInterface.vaues("g");
                return;
            }
            if (s.equals("DE04EB2000100001DF")) {
                this.keyboardsInterface.vaues("h");
                return;
            }
            if (s.equals("DE04EB4040000031DF")) {
                this.keyboardsInterface.vaues("20");
                return;
            }
            if (s.equals("DE04EB4020000051DF")) {
                this.keyboardsInterface.vaues("i");
                return;
            }
            if (s.equals("DE04EB4010000061DF")) {
                this.keyboardsInterface.vaues("j");
                return;
            }
            if (s.equals("DE04EB4000010070DF")) {
                this.keyboardsInterface.vaues("k");
                return;
            }
            if (s.equals("DE04EB4000020073DF")) {
                this.keyboardsInterface.vaues("l");
                return;
            }
            if (s.equals("DE04EB4000040075DF")) {
                this.keyboardsInterface.vaues("m");
                return;
            }
            if (s.equals("DE04EB4000080079DF")) {
                this.keyboardsInterface.vaues("n");
                return;
            }
            if (s.equals("DE04EB4000200051DF")) {
                this.keyboardsInterface.vaues("o");
                return;
            }
            if (s.equals("DE04EB4000100061DF")) {
                this.keyboardsInterface.vaues("p");
                return;
            }
            if (s.equals("DE04EB04800000B5DF")) {
                this.keyboardsInterface.vaues("28");
                return;
            }
            if (s.equals("DE04EB0440000075DF")) {
                this.keyboardsInterface.vaues("29");
                return;
            }
            if (s.equals("DE04EB0420000015DF")) {
                this.keyboardsInterface.vaues("q");
                return;
            }
            if (s.equals("DE04EB0410000025DF")) {
                this.keyboardsInterface.vaues("r");
                return;
            }
            if (s.equals("DE04EB0400010034DF")) {
                this.keyboardsInterface.vaues("s");
                return;
            }
            if (s.equals("DE04EB0400020037DF")) {
                this.keyboardsInterface.vaues("t");
                return;
            }
            if (s.equals("DE04EB0400040031DF")) {
                this.keyboardsInterface.vaues("u");
                return;
            }
            if (s.equals("DE04EB040008003DDF")) {
                this.keyboardsInterface.vaues("v");
                return;
            }
            if (s.equals("DE04EB0400200015DF")) {
                this.keyboardsInterface.vaues("w");
                return;
            }
            if ("DE04EB0400100025DF".equals(s)) {
                this.keyboardsInterface.vaues("x");
                return;
            }
            if (s.equals("DE04EB02800000B3DF")) {
                this.keyboardsInterface.vaues("37");
                return;
            }
            if (s.equals("DE04EB0240000073DF")) {
                this.keyboardsInterface.vaues("38");
                return;
            }
            if (s.equals("DE04EB0220000013DF")) {
                this.keyboardsInterface.vaues("y");
                return;
            }
            if (s.equals("DE04EB0210000023DF")) {
                this.keyboardsInterface.vaues("z");
                return;
            }
            if (s.equals("DE04EB0200010032DF")) {
                this.keyboardsInterface.vaues("27");
                return;
            }
            if (s.equals("DE04EB0200020031DF")) {
                this.keyboardsInterface.vaues("28");
                return;
            }
            if (s.equals("DE04EB0200040037DF")) {
                this.keyboardsInterface.vaues("29");
                return;
            }
            if (s.equals("DE04EB020008003BDF")) {
                this.keyboardsInterface.vaues("30");
                return;
            }
            if (s.equals("DE04EB0200200013DF")) {
                this.keyboardsInterface.vaues("31");
                return;
            }
            if (s.equals("DE04EB0200100023DF")) {
                this.keyboardsInterface.vaues("32");
                return;
            }
            if (s.equals("DE04EB0140000070DF")) {
                this.keyboardsInterface.vaues("47");
                return;
            }
            if (s.equals("DE04EB0120000010DF")) {
                this.keyboardsInterface.vaues("48");
                return;
            }
            if (s.equals("DE04EB0110000020DF")) {
                this.keyboardsInterface.vaues("49");
                return;
            }
            if (s.equals("DE04EB0100010031DF")) {
                this.keyboardsInterface.vaues("50");
                return;
            }
            if (s.equals("DE04EB0100020032DF")) {
                this.keyboardsInterface.vaues("51");
                return;
            }
            if (s.equals("DE04EB0100040034DF")) {
                this.keyboardsInterface.vaues("52");
                return;
            }
            if (s.equals("DE04EB0100080038DF")) {
                this.keyboardsInterface.vaues("53");
                return;
            }
            if (s.equals("DE04EB0100200010DF")) {
                this.keyboardsInterface.vaues("54");
                return;
            }
            if (s.equals("DE04EBFF8000004EDF")) {
                this.keyboardsInterface.vaues("55");
                return;
            }
            if (s.equals("DE04EBFF4000008EDF")) {
                this.keyboardsInterface.vaues("56");
                return;
            }
            if (s.equals("DE04EBFF200000EEDF")) {
                this.keyboardsInterface.vaues("33");
                return;
            }
            if (s.equals("DE04EBFF100000DEDF")) {
                this.keyboardsInterface.vaues("34");
                return;
            }
            if (s.equals("DE04EBFF000100CFDF")) {
                this.keyboardsInterface.vaues("35");
                return;
            }
            if (s.equals("DE04EBFF000200CCDF")) {
                this.keyboardsInterface.vaues("36");
                return;
            }
            if (s.equals("DE04EBFF000400CADF")) {
                this.keyboardsInterface.vaues("37");
                return;
            }
            if (s.equals("DE04EBFF000800C6DF")) {
                this.keyboardsInterface.vaues("38");
                return;
            }
            if (s.equals("DE04EBFF002000EEDF")) {
                this.keyboardsInterface.vaues("39");
                return;
            }
            if (s.equals("DE04EBFF001000DEDF")) {
                this.keyboardsInterface.vaues("40");
                return;
            }
            if (s.equals("DE04EB0100100020DF")) {
                this.keyboardsInterface.vaues("DE04EB0100100020DF");
            }
        }
    }
    
    public void analysisDataOld(final String s) {
        final int index = s.indexOf("DE16F8");
        int i = 0;
        if (index == 0 && s.length() >= 42) {
            if (this.weightInterface == null) {
                return;
            }
            final String replace = s.replace("DE16F8", "");
            if (replace.length() >= 24) {
                final String substring = replace.substring(0, 2);
                final String substring2 = replace.substring(2, 4);
                final String substring3 = replace.substring(4, 6);
                final String substring4 = replace.substring(6, 8);
                final String substring5 = replace.substring(8, 10);
                final double double1 = Double.parseDouble(substring4);
                final double double2 = Double.parseDouble(substring3);
                final double double3 = Double.parseDouble(substring2);
                final double double4 = Double.parseDouble(substring);
                final int int1 = Integer.parseInt(substring5);
                String string = "";
                double n = double1 * 1000000.0 + double2 * 10000.0 + double3 * 100.0 + double4;
                while (i < int1) {
                    n /= 10.0;
                    final StringBuilder sb = new StringBuilder();
                    sb.append(string);
                    sb.append("0");
                    string = sb.toString();
                    ++i;
                }
                final StringBuilder sb2 = new StringBuilder();
                sb2.append("######0.");
                sb2.append(string);
                final DecimalFormat decimalFormat = new DecimalFormat(sb2.toString());
                final String format = decimalFormat.format(n);
                double n2 = Double.parseDouble(replace.substring(18, 20)) * 1000000.0 + Double.parseDouble(replace.substring(16, 18)) * 10000.0 + Double.parseDouble(replace.substring(14, 16)) * 100.0 + Double.parseDouble(replace.substring(12, 14));
                for (int j = 0; j < int1; ++j) {
                    n2 /= 10.0;
                }
                this.weightInterface.skinWeight(decimalFormat.format(n2));
                final String substring6 = replace.substring(20, 22);
                final String substring7 = replace.substring(22, 24);
                final String substring8 = replace.substring(24, 26);
                final int int2 = Integer.parseInt(replace.substring(26, 28));
                final int int3 = Integer.parseInt(substring8);
                final int int4 = Integer.parseInt(substring7);
                final int int5 = Integer.parseInt(substring6);
                final WeightInterface weightInterface = this.weightInterface;
                final StringBuilder sb3 = new StringBuilder();
                sb3.append(int2 * 1000000 + int3 * 10000 + int4 * 100 + int5);
                sb3.append("");
                weightInterface.start_ad(sb3.toString());
                final String substring9 = replace.substring(28, 30);
                final String substring10 = replace.substring(30, 32);
                final String substring11 = replace.substring(32, 34);
                final int int6 = Integer.parseInt(replace.substring(34, 36));
                final int int7 = Integer.parseInt(substring11);
                final int int8 = Integer.parseInt(substring10);
                final int int9 = Integer.parseInt(substring9);
                final WeightInterface weightInterface2 = this.weightInterface;
                final StringBuilder sb4 = new StringBuilder();
                sb4.append(int6 * 1000000 + int7 * 10000 + int8 * 100 + int9);
                sb4.append("");
                weightInterface2.skinWeight_ad(sb4.toString());
                final String substring12 = replace.substring(36, 38);
                final String substring13 = replace.substring(38, 40);
                final String substring14 = replace.substring(40, 42);
                final int int10 = Integer.parseInt(replace.substring(42, 44));
                final int int11 = Integer.parseInt(substring14);
                final int int12 = Integer.parseInt(substring13);
                final int int13 = Integer.parseInt(substring12);
                final WeightInterface weightInterface3 = this.weightInterface;
                final StringBuilder sb5 = new StringBuilder();
                sb5.append(int10 * 1000000 + int11 * 10000 + int12 * 100 + int13);
                sb5.append("");
                weightInterface3.curent_ad(sb5.toString());
                final int int14 = Integer.parseInt(replace.substring(10, 12), 16);
                String string2 = "";
                for (int k = 7; k >= 0; --k) {
                    final StringBuilder sb6 = new StringBuilder();
                    sb6.append(string2);
                    sb6.append(int14 >> k & 0x1);
                    string2 = sb6.toString();
                }
                if (string2.length() == 8) {
                    final String substring15 = string2.substring(7, 8);
                    final String s2 = "1";
                    if (s2.equals(substring15)) {
                        this.weightInterface.stabilityWeight(1);
                    }
                    else {
                        this.weightInterface.stabilityWeight(0);
                    }
                    if (s2.equals(string2.substring(6, 7))) {
                        this.weightInterface.overload(1);
                    }
                    else {
                        this.weightInterface.overload(0);
                    }
                    if (s2.equals(string2.substring(5, 6))) {
                        this.weightInterface.loadBearing(1);
                        final WeightInterface weightInterface4 = this.weightInterface;
                        final StringBuilder sb7 = new StringBuilder();
                        sb7.append("-");
                        sb7.append(format);
                        weightInterface4.weight(sb7.toString());
                    }
                    else {
                        this.weightInterface.loadBearing(0);
                        this.weightInterface.weight(format);
                    }
                    if (s2.equals(string2.substring(4, 5))) {
                        this.weightInterface.peel(1);
                    }
                    else {
                        this.weightInterface.peel(0);
                    }
                    if (s2.equals(string2.substring(3, 4))) {
                        this.weightInterface.zeroPosition(1);
                    }
                    else {
                        this.weightInterface.zeroPosition(0);
                    }
                    if (s2.equals(string2.substring(2, 3))) {
                        this.weightInterface.error(1);
                    }
                    else {
                        this.weightInterface.error(0);
                    }
                    if (s2.equals(string2.substring(1, 2))) {
                        this.weightInterface.range(1);
                    }
                    else {
                        this.weightInterface.range(0);
                    }
                }
            }
        }
        if (s.equals("DE02E001003DDF")) {
            final CaliBrationInterface caliBrationInterface = this.caliBrationInterface;
            if (caliBrationInterface != null) {
                caliBrationInterface.start_step(0);
            }
        }
        else if (s.equals("DE02E000003CDF")) {
            final CaliBrationInterface caliBrationInterface2 = this.caliBrationInterface;
            if (caliBrationInterface2 != null) {
                caliBrationInterface2.start_step(1);
            }
        }
        else if (s.equals("DE02E006003ADF")) {
            final CaliBrationInterface caliBrationInterface3 = this.caliBrationInterface;
            if (caliBrationInterface3 != null) {
                caliBrationInterface3.start_step(2);
            }
        }
        else if (s.equals("DE02E000003CDF")) {
            final CaliBrationInterface caliBrationInterface4 = this.caliBrationInterface;
            if (caliBrationInterface4 != null) {
                caliBrationInterface4.start_step(3);
            }
        }
        else if (s.equals("DE02E002003EDF")) {
            final CaliBrationInterface caliBrationInterface5 = this.caliBrationInterface;
            if (caliBrationInterface5 != null) {
                caliBrationInterface5.start_step(4);
            }
        }
        else if (s.equals("DE02E003003FDF")) {
            final CaliBrationInterface caliBrationInterface6 = this.caliBrationInterface;
            if (caliBrationInterface6 != null) {
                caliBrationInterface6.start_step(5);
            }
        }
        else if (s.indexOf("DE10E004") == 0) {
            final CaliBrationInterface caliBrationInterface7 = this.caliBrationInterface;
            if (caliBrationInterface7 != null) {
                caliBrationInterface7.start_step(7);
            }
        }
        else if (s.equals("7E02E90000957F")) {
            final CaliBrationInterface caliBrationInterface8 = this.caliBrationInterface;
            if (caliBrationInterface8 != null) {
                caliBrationInterface8.start_step(11);
            }
        }
        else if (s.equals("DE02E003003FDF")) {
            final CaliBrationInterface caliBrationInterface9 = this.caliBrationInterface;
            if (caliBrationInterface9 != null) {
                caliBrationInterface9.start_step(12);
            }
        }
        if (s.length() >= 24) {
            final String substring16 = s.substring(18, 20);
            if (s.indexOf("DE07EB") == 0 && substring16.equals("DC")) {
                final int int15 = Integer.parseInt(s.replace("DE07EB", "").substring(10, 12), 16);
                final KeyboardInterface keyboardInterface = this.keyboardInterface;
                if (keyboardInterface != null) {
                    int n3;
                    if (int15 >= 16 && int15 <= 26) {
                        n3 = int15 - 15;
                    }
                    else if (int15 >= 32 && int15 <= 42) {
                        n3 = int15 - 20;
                    }
                    else if (int15 >= 48 && int15 <= 58) {
                        n3 = int15 - 25;
                    }
                    else if (int15 >= 64 && int15 <= 74) {
                        n3 = int15 - 30;
                    }
                    else if (int15 >= 80 && int15 <= 90) {
                        n3 = int15 - 35;
                    }
                    else if (int15 >= 96 && int15 <= 106) {
                        n3 = int15 - 40;
                    }
                    else if (int15 >= 112 && int15 <= 122) {
                        n3 = int15 - 45;
                    }
                    else {
                        n3 = 0;
                    }
                    if (n3 > 0) {
                        keyboardInterface.numberleans(n3);
                        return;
                    }
                }
                if (keyboardInterface != null) {
                    String s3;
                    if (int15 == 123) {
                        s3 = "0";
                    }
                    else if (int15 == 124) {
                        s3 = "00";
                    }
                    else if (int15 == 107) {
                        s3 = "1";
                    }
                    else if (int15 == 108) {
                        s3 = "2";
                    }
                    else if (int15 == 109) {
                        s3 = "3";
                    }
                    else if (int15 == 91) {
                        s3 = "4";
                    }
                    else if (int15 == 92) {
                        s3 = "5";
                    }
                    else if (int15 == 93) {
                        s3 = "6";
                    }
                    else if (int15 == 75) {
                        s3 = "7";
                    }
                    else if (int15 == 76) {
                        s3 = "8";
                    }
                    else if (int15 == 77) {
                        s3 = "9";
                    }
                    else {
                        s3 = "";
                    }
                    if (s3 != null && !s3.equals("")) {
                        this.keyboardInterface.number(s3);
                        return;
                    }
                }
                if (int15 == 61) {
                    this.sendSerialPort(Cmd.OPEN_MANY);
                }
                else if (int15 == 62) {
                    this.sendSerialPort(Cmd.OPEN_MANY);
                }
                final KeyboardToolsInterface keyboardToolsInterface = this.keyboardToolsInterface;
                if (keyboardToolsInterface != null) {
                    if (int15 == 27) {
                        keyboardToolsInterface.turnPage();
                    }
                    else if (int15 == 28) {
                        keyboardToolsInterface.pluOrUp();
                    }
                    else if (int15 == 29) {
                        keyboardToolsInterface.setOrReturn();
                    }
                    else if (int15 == 30) {
                        keyboardToolsInterface.repeatPrint();
                    }
                    else if (int15 == 43) {
                        keyboardToolsInterface.paperOrLeft();
                    }
                    else if (int15 == 44) {
                        keyboardToolsInterface.timeOrDown();
                    }
                    else if (int15 == 45) {
                        keyboardToolsInterface.lockPriceOrRight();
                    }
                    else if (int15 == 46) {
                        keyboardToolsInterface.priceUpdata();
                    }
                    else if (int15 == 59) {
                        keyboardToolsInterface.communicationOrPassword();
                    }
                    else if (int15 == 60) {
                        keyboardToolsInterface.discount();
                    }
                    else if (int15 == 61) {
                        keyboardToolsInterface.peel();
                        this.sendSerialPort(Cmd.OPEN_MANY);
                    }
                    else if (int15 == 62) {
                        keyboardToolsInterface.zeroSetting();
                        this.sendSerialPort(Cmd.OPEN_MANY);
                    }
                    else if (int15 == 78) {
                        keyboardToolsInterface.X();
                    }
                    else if (int15 == 94) {
                        keyboardToolsInterface.cancel();
                    }
                    else if (int15 == 110) {
                        keyboardToolsInterface.automaticPrint();
                    }
                    else if (int15 == 125) {
                        keyboardToolsInterface.print();
                    }
                    else if (int15 == 126) {
                        keyboardToolsInterface.confirm();
                    }
                }
            }
        }
        if (s.indexOf("DE04EB") == 0) {
            System.out.println(s);
            final StringBuilder sb8 = new StringBuilder();
            sb8.append("\u952e\u76d8\u6570\u636e --> ");
            sb8.append(s);
            LogUtils.d(sb8.toString());
        }
        if (this.keyboardsInterface != null && s.indexOf("DE04EB") == 0) {
            if (s.equals("DE04EB0100000131DF")) {
                this.keyboardsInterface.vaues("\u4f1a\u5458\u5361");
                return;
            }
            if (s.equals("DE04EB0100000232DF")) {
                this.keyboardsInterface.vaues("\u5fae\u4fe1");
                return;
            }
            if (s.equals("DE04EB0100000434DF")) {
                this.keyboardsInterface.vaues("\u652f\u4ed8\u5b9d");
                return;
            }
            if (s.equals("DE04EB0100000838DF")) {
                this.keyboardsInterface.vaues("\u73b0\u91d1");
                return;
            }
            if (s.equals("DE04EB0100001020DF")) {
                this.keyboardsInterface.vaues("\u6253\u5370");
                return;
            }
            if (s.equals("DE04EB0200000132DF")) {
                this.keyboardsInterface.vaues("0");
                return;
            }
            if (s.equals("DE04EB0200000231DF")) {
                this.keyboardsInterface.vaues("00");
                return;
            }
            if (s.equals("DE04EB0200000437DF")) {
                this.keyboardsInterface.vaues("\u53d6\u6d88");
                return;
            }
            if (s.equals("DE04EB020000083BDF")) {
                this.keyboardsInterface.vaues("\u7d2f\u8ba1");
                return;
            }
            if (s.equals("DE04EB0200001023DF")) {
                this.keyboardsInterface.vaues("\u7d2f\u6e05");
                return;
            }
            if (s.equals("DE04EB0400000134DF")) {
                this.keyboardsInterface.vaues("1");
                return;
            }
            if (s.equals("DE04EB0400000237DF")) {
                this.keyboardsInterface.vaues("2");
                return;
            }
            if (s.equals("DE04EB0400000431DF")) {
                this.keyboardsInterface.vaues("3");
                return;
            }
            if (s.equals("DE04EB040000083DDF")) {
                this.keyboardsInterface.vaues("PLU");
                return;
            }
            if (s.equals("DE04EB0400001025DF")) {
                this.keyboardsInterface.vaues("\u5176\u4ed6");
                return;
            }
            if (s.equals("DE04EB4000000170DF")) {
                this.keyboardsInterface.vaues("4");
                return;
            }
            if (s.equals("DE04EB4000000273DF")) {
                this.keyboardsInterface.vaues("5");
                return;
            }
            if (s.equals("DE04EB4000000475DF")) {
                this.keyboardsInterface.vaues("6");
                return;
            }
            if (s.equals("DE04EB4000000879DF")) {
                this.keyboardsInterface.vaues("X");
                return;
            }
            if (s.equals("DE04EB4000001061DF")) {
                this.keyboardsInterface.vaues("\u7f6e\u96f6");
                return;
            }
            if (s.equals("DE04EB2000000110DF")) {
                this.keyboardsInterface.vaues("7");
                return;
            }
            if (s.equals("DE04EB2000000213DF")) {
                this.keyboardsInterface.vaues("8");
                return;
            }
            if (s.equals("DE04EB2000000415DF")) {
                this.keyboardsInterface.vaues("9");
                return;
            }
            if (s.equals("DE04EB2000000819DF")) {
                this.keyboardsInterface.vaues("\u8fd4\u56de");
                return;
            }
            if (s.equals("DE04EB2000001001DF")) {
                this.keyboardsInterface.vaues("\u53bb\u76ae");
                return;
            }
            if (s.equals("DE04EB1000000120DF")) {
                this.keyboardsInterface.vaues("+A");
                return;
            }
            if (s.equals("DE04EB1000000223DF")) {
                this.keyboardsInterface.vaues("+B");
                return;
            }
            if (s.equals("DE04EB1000000425DF")) {
                this.keyboardsInterface.vaues("+C");
                return;
            }
            if (s.equals("DE04EB1000000829DF")) {
                this.keyboardsInterface.vaues("+D");
                return;
            }
            if (s.equals("DE04EB1000001031DF")) {
                this.keyboardsInterface.vaues("\u8bbe\u7f6e");
                return;
            }
            if (s.equals("DE04EB10800000A1DF")) {
                this.keyboardsInterface.vaues("1");
                return;
            }
            if (s.equals("DE04EB1040000061DF")) {
                this.keyboardsInterface.vaues("2");
                return;
            }
            if (s.equals("DE04EB1020000001DF")) {
                this.keyboardsInterface.vaues("3");
                return;
            }
            if (s.equals("DE04EB1010000031DF")) {
                this.keyboardsInterface.vaues("4");
                return;
            }
            if (s.equals("DE04EB1000010020DF")) {
                this.keyboardsInterface.vaues("5");
                return;
            }
            if (s.equals("DE04EB1000020023DF")) {
                this.keyboardsInterface.vaues("6");
                return;
            }
            if (s.equals("DE04EB1000040025DF")) {
                this.keyboardsInterface.vaues("7");
                return;
            }
            if (s.equals("DE04EB1000080029DF")) {
                this.keyboardsInterface.vaues("8");
                return;
            }
            if (s.equals("DE04EB1000200001DF")) {
                this.keyboardsInterface.vaues("9");
                return;
            }
            if (s.equals("DE04EB2080000091DF")) {
                this.keyboardsInterface.vaues("10");
                return;
            }
            if (s.equals("DE04EB2040000051DF")) {
                this.keyboardsInterface.vaues("11");
                return;
            }
            if (s.equals("DE04EB2020000031DF")) {
                this.keyboardsInterface.vaues("a");
                return;
            }
            if (s.equals("DE04EB2010000001DF")) {
                this.keyboardsInterface.vaues("b");
                return;
            }
            if (s.equals("DE04EB2000010010DF")) {
                this.keyboardsInterface.vaues("c");
                return;
            }
            if (s.equals("DE04EB2000020013DF")) {
                this.keyboardsInterface.vaues("d");
                return;
            }
            if (s.equals("DE04EB2000040015DF")) {
                this.keyboardsInterface.vaues("e");
                return;
            }
            if (s.equals("DE04EB2000080019DF")) {
                this.keyboardsInterface.vaues("f");
                return;
            }
            if (s.equals("DE04EB2000200031DF")) {
                this.keyboardsInterface.vaues("g");
                return;
            }
            if (s.equals("DE04EB2000100001DF")) {
                this.keyboardsInterface.vaues("h");
                return;
            }
            if (s.equals("DE04EB4040000031DF")) {
                this.keyboardsInterface.vaues("20");
                return;
            }
            if (s.equals("DE04EB4020000051DF")) {
                this.keyboardsInterface.vaues("i");
                return;
            }
            if (s.equals("DE04EB4010000061DF")) {
                this.keyboardsInterface.vaues("j");
                return;
            }
            if (s.equals("DE04EB4000010070DF")) {
                this.keyboardsInterface.vaues("k");
                return;
            }
            if (s.equals("DE04EB4000020073DF")) {
                this.keyboardsInterface.vaues("l");
                return;
            }
            if (s.equals("DE04EB4000040075DF")) {
                this.keyboardsInterface.vaues("m");
                return;
            }
            if (s.equals("DE04EB4000080079DF")) {
                this.keyboardsInterface.vaues("n");
                return;
            }
            if (s.equals("DE04EB4000200051DF")) {
                this.keyboardsInterface.vaues("o");
                return;
            }
            if (s.equals("DE04EB4000100061DF")) {
                this.keyboardsInterface.vaues("p");
                return;
            }
            if (s.equals("DE04EB04800000B5DF")) {
                this.keyboardsInterface.vaues("28");
                return;
            }
            if (s.equals("DE04EB0440000075DF")) {
                this.keyboardsInterface.vaues("29");
                return;
            }
            if (s.equals("DE04EB0420000015DF")) {
                this.keyboardsInterface.vaues("q");
                return;
            }
            if (s.equals("DE04EB0410000025DF")) {
                this.keyboardsInterface.vaues("r");
                return;
            }
            if (s.equals("DE04EB0400010034DF")) {
                this.keyboardsInterface.vaues("s");
                return;
            }
            if (s.equals("DE04EB0400020037DF")) {
                this.keyboardsInterface.vaues("t");
                return;
            }
            if (s.equals("DE04EB0400040031DF")) {
                this.keyboardsInterface.vaues("u");
                return;
            }
            if (s.equals("DE04EB040008003DDF")) {
                this.keyboardsInterface.vaues("v");
                return;
            }
            if (s.equals("DE04EB0400200015DF")) {
                this.keyboardsInterface.vaues("w");
                return;
            }
            if ("DE04EB0400100025DF".equals(s)) {
                this.keyboardsInterface.vaues("x");
                return;
            }
            if (s.equals("DE04EB02800000B3DF")) {
                this.keyboardsInterface.vaues("37");
                return;
            }
            if (s.equals("DE04EB0240000073DF")) {
                this.keyboardsInterface.vaues("38");
                return;
            }
            if (s.equals("DE04EB0220000013DF")) {
                this.keyboardsInterface.vaues("y");
                return;
            }
            if (s.equals("DE04EB0210000023DF")) {
                this.keyboardsInterface.vaues("z");
                return;
            }
            if (s.equals("DE04EB0200010032DF")) {
                this.keyboardsInterface.vaues("27");
                return;
            }
            if (s.equals("DE04EB0200020031DF")) {
                this.keyboardsInterface.vaues("28");
                return;
            }
            if (s.equals("DE04EB0200040037DF")) {
                this.keyboardsInterface.vaues("29");
                return;
            }
            if (s.equals("DE04EB020008003BDF")) {
                this.keyboardsInterface.vaues("30");
                return;
            }
            if (s.equals("DE04EB0200200013DF")) {
                this.keyboardsInterface.vaues("31");
                return;
            }
            if (s.equals("DE04EB0200100023DF")) {
                this.keyboardsInterface.vaues("32");
                return;
            }
            if (s.equals("DE04EB0140000070DF")) {
                this.keyboardsInterface.vaues("47");
                return;
            }
            if (s.equals("DE04EB0120000010DF")) {
                this.keyboardsInterface.vaues("48");
                return;
            }
            if (s.equals("DE04EB0110000020DF")) {
                this.keyboardsInterface.vaues("49");
                return;
            }
            if (s.equals("DE04EB0100010031DF")) {
                this.keyboardsInterface.vaues("50");
                return;
            }
            if (s.equals("DE04EB0100020032DF")) {
                this.keyboardsInterface.vaues("51");
                return;
            }
            if (s.equals("DE04EB0100040034DF")) {
                this.keyboardsInterface.vaues("52");
                return;
            }
            if (s.equals("DE04EB0100080038DF")) {
                this.keyboardsInterface.vaues("53");
                return;
            }
            if (s.equals("DE04EB0100200010DF")) {
                this.keyboardsInterface.vaues("54");
                return;
            }
            if (s.equals("DE04EBFF8000004EDF")) {
                this.keyboardsInterface.vaues("55");
                return;
            }
            if (s.equals("DE04EBFF4000008EDF")) {
                this.keyboardsInterface.vaues("56");
                return;
            }
            if (s.equals("DE04EBFF200000EEDF")) {
                this.keyboardsInterface.vaues("33");
                return;
            }
            if (s.equals("DE04EBFF100000DEDF")) {
                this.keyboardsInterface.vaues("34");
                return;
            }
            if (s.equals("DE04EBFF000100CFDF")) {
                this.keyboardsInterface.vaues("35");
                return;
            }
            if (s.equals("DE04EBFF000200CCDF")) {
                this.keyboardsInterface.vaues("36");
                return;
            }
            if (s.equals("DE04EBFF000400CADF")) {
                this.keyboardsInterface.vaues("37");
                return;
            }
            if (s.equals("DE04EBFF000800C6DF")) {
                this.keyboardsInterface.vaues("38");
                return;
            }
            if (s.equals("DE04EBFF002000EEDF")) {
                this.keyboardsInterface.vaues("39");
                return;
            }
            if (s.equals("DE04EBFF001000DEDF")) {
                this.keyboardsInterface.vaues("40");
                return;
            }
            if (s.equals("DE04EB0100100020DF")) {
                this.keyboardsInterface.vaues("DE04EB0100100020DF");
            }
        }
    }
    
    public void analysisDataOut(final String s) {
        final int index = s.indexOf("DE16F8");
        int i = 0;
        if (index == 0 && s.length() >= 42) {
            if (this.weightInterface == null) {
                return;
            }
            final String replace = s.replace("DE16F8", "");
            if (replace.length() >= 24) {
                final String substring = replace.substring(0, 2);
                final String substring2 = replace.substring(2, 4);
                final String substring3 = replace.substring(4, 6);
                final String substring4 = replace.substring(6, 8);
                final String substring5 = replace.substring(8, 10);
                final double double1 = Double.parseDouble(substring4);
                final double double2 = Double.parseDouble(substring3);
                final double double3 = Double.parseDouble(substring2);
                final double double4 = Double.parseDouble(substring);
                final int int1 = Integer.parseInt(substring5);
                String string = "";
                double n = double1 * 1000000.0 + double2 * 10000.0 + double3 * 100.0 + double4;
                while (i < int1) {
                    n /= 10.0;
                    final StringBuilder sb = new StringBuilder();
                    sb.append(string);
                    sb.append("0");
                    string = sb.toString();
                    ++i;
                }
                final StringBuilder sb2 = new StringBuilder();
                sb2.append("######0.");
                sb2.append(string);
                final DecimalFormat decimalFormat = new DecimalFormat(sb2.toString());
                final String format = decimalFormat.format(n);
                double n2 = Double.parseDouble(replace.substring(18, 20)) * 1000000.0 + Double.parseDouble(replace.substring(16, 18)) * 10000.0 + Double.parseDouble(replace.substring(14, 16)) * 100.0 + Double.parseDouble(replace.substring(12, 14));
                for (int j = 0; j < int1; ++j) {
                    n2 /= 10.0;
                }
                this.weightInterface.skinWeight(decimalFormat.format(n2));
                final String substring6 = replace.substring(20, 22);
                final String substring7 = replace.substring(22, 24);
                final String substring8 = replace.substring(24, 26);
                final int int2 = Integer.parseInt(replace.substring(26, 28));
                final int int3 = Integer.parseInt(substring8);
                final int int4 = Integer.parseInt(substring7);
                final int int5 = Integer.parseInt(substring6);
                final WeightInterface weightInterface = this.weightInterface;
                final StringBuilder sb3 = new StringBuilder();
                sb3.append(int2 * 1000000 + int3 * 10000 + int4 * 100 + int5);
                sb3.append("");
                weightInterface.start_ad(sb3.toString());
                final String substring9 = replace.substring(28, 30);
                final String substring10 = replace.substring(30, 32);
                final String substring11 = replace.substring(32, 34);
                final int int6 = Integer.parseInt(replace.substring(34, 36));
                final int int7 = Integer.parseInt(substring11);
                final int int8 = Integer.parseInt(substring10);
                final int int9 = Integer.parseInt(substring9);
                final WeightInterface weightInterface2 = this.weightInterface;
                final StringBuilder sb4 = new StringBuilder();
                sb4.append(int6 * 1000000 + int7 * 10000 + int8 * 100 + int9);
                sb4.append("");
                weightInterface2.skinWeight_ad(sb4.toString());
                final String substring12 = replace.substring(36, 38);
                final String substring13 = replace.substring(38, 40);
                final String substring14 = replace.substring(40, 42);
                final int int10 = Integer.parseInt(replace.substring(42, 44));
                final int int11 = Integer.parseInt(substring14);
                final int int12 = Integer.parseInt(substring13);
                final int int13 = Integer.parseInt(substring12);
                final WeightInterface weightInterface3 = this.weightInterface;
                final StringBuilder sb5 = new StringBuilder();
                sb5.append(int10 * 1000000 + int11 * 10000 + int12 * 100 + int13);
                sb5.append("");
                weightInterface3.curent_ad(sb5.toString());
                final int int14 = Integer.parseInt(replace.substring(10, 12), 16);
                String string2 = "";
                for (int k = 7; k >= 0; --k) {
                    final StringBuilder sb6 = new StringBuilder();
                    sb6.append(string2);
                    sb6.append(int14 >> k & 0x1);
                    string2 = sb6.toString();
                }
                if (string2.length() == 8) {
                    final String substring15 = string2.substring(7, 8);
                    final String s2 = "1";
                    if (s2.equals(substring15)) {
                        this.weightInterface.stabilityWeight(1);
                    }
                    else {
                        this.weightInterface.stabilityWeight(0);
                    }
                    if (s2.equals(string2.substring(6, 7))) {
                        this.weightInterface.overload(1);
                    }
                    else {
                        this.weightInterface.overload(0);
                    }
                    if (s2.equals(string2.substring(5, 6))) {
                        this.weightInterface.loadBearing(1);
                        final WeightInterface weightInterface4 = this.weightInterface;
                        final StringBuilder sb7 = new StringBuilder();
                        sb7.append("-");
                        sb7.append(format);
                        weightInterface4.weight(sb7.toString());
                    }
                    else {
                        this.weightInterface.loadBearing(0);
                        this.weightInterface.weight(format);
                    }
                    if (s2.equals(string2.substring(4, 5))) {
                        this.weightInterface.peel(1);
                    }
                    else {
                        this.weightInterface.peel(0);
                    }
                    if (s2.equals(string2.substring(3, 4))) {
                        this.weightInterface.zeroPosition(1);
                    }
                    else {
                        this.weightInterface.zeroPosition(0);
                    }
                    if (s2.equals(string2.substring(2, 3))) {
                        this.weightInterface.error(1);
                    }
                    else {
                        this.weightInterface.error(0);
                    }
                    if (s2.equals(string2.substring(1, 2))) {
                        this.weightInterface.range(1);
                    }
                    else {
                        this.weightInterface.range(0);
                    }
                }
            }
        }
        if (s.equals("DE02E001003DDF")) {
            final CaliBrationInterface caliBrationInterface = this.caliBrationInterface;
            if (caliBrationInterface != null) {
                caliBrationInterface.start_step(0);
            }
        }
        else if (s.equals("DE02E000003CDF")) {
            final CaliBrationInterface caliBrationInterface2 = this.caliBrationInterface;
            if (caliBrationInterface2 != null) {
                caliBrationInterface2.start_step(1);
            }
        }
        else if (s.equals("DE02E006003ADF")) {
            final CaliBrationInterface caliBrationInterface3 = this.caliBrationInterface;
            if (caliBrationInterface3 != null) {
                caliBrationInterface3.start_step(2);
            }
        }
        else if (s.equals("DE02E000003CDF")) {
            final CaliBrationInterface caliBrationInterface4 = this.caliBrationInterface;
            if (caliBrationInterface4 != null) {
                caliBrationInterface4.start_step(3);
            }
        }
        else if (s.equals("DE02E002003EDF")) {
            final CaliBrationInterface caliBrationInterface5 = this.caliBrationInterface;
            if (caliBrationInterface5 != null) {
                caliBrationInterface5.start_step(4);
            }
        }
        else if (s.equals("DE02E003003FDF")) {
            final CaliBrationInterface caliBrationInterface6 = this.caliBrationInterface;
            if (caliBrationInterface6 != null) {
                caliBrationInterface6.start_step(5);
            }
        }
        else if (s.indexOf("DE10E004") == 0) {
            final CaliBrationInterface caliBrationInterface7 = this.caliBrationInterface;
            if (caliBrationInterface7 != null) {
                caliBrationInterface7.start_step(7);
            }
        }
        else if (s.equals("7E02E90000957F")) {
            final CaliBrationInterface caliBrationInterface8 = this.caliBrationInterface;
            if (caliBrationInterface8 != null) {
                caliBrationInterface8.start_step(11);
            }
        }
        else if (s.equals("DE02E003003FDF")) {
            final CaliBrationInterface caliBrationInterface9 = this.caliBrationInterface;
            if (caliBrationInterface9 != null) {
                caliBrationInterface9.start_step(12);
            }
        }
        if (s.length() >= 24) {
            final String substring16 = s.substring(18, 20);
            if (s.indexOf("DE07EB") == 0 && substring16.equals("DC")) {
                final int int15 = Integer.parseInt(s.replace("DE07EB", "").substring(10, 12), 16);
                final KeyboardInterface keyboardInterface = this.keyboardInterface;
                if (keyboardInterface != null) {
                    int n3;
                    if (int15 >= 16 && int15 <= 26) {
                        n3 = int15 - 15;
                    }
                    else if (int15 >= 32 && int15 <= 42) {
                        n3 = int15 - 20;
                    }
                    else if (int15 >= 48 && int15 <= 58) {
                        n3 = int15 - 25;
                    }
                    else if (int15 >= 64 && int15 <= 74) {
                        n3 = int15 - 30;
                    }
                    else if (int15 >= 80 && int15 <= 90) {
                        n3 = int15 - 35;
                    }
                    else if (int15 >= 96 && int15 <= 106) {
                        n3 = int15 - 40;
                    }
                    else if (int15 >= 112 && int15 <= 122) {
                        n3 = int15 - 45;
                    }
                    else {
                        n3 = 0;
                    }
                    if (n3 > 0) {
                        keyboardInterface.numberleans(n3);
                        return;
                    }
                }
                if (keyboardInterface != null) {
                    String s3;
                    if (int15 == 123) {
                        s3 = "0";
                    }
                    else if (int15 == 124) {
                        s3 = "00";
                    }
                    else if (int15 == 107) {
                        s3 = "1";
                    }
                    else if (int15 == 108) {
                        s3 = "2";
                    }
                    else if (int15 == 109) {
                        s3 = "3";
                    }
                    else if (int15 == 91) {
                        s3 = "4";
                    }
                    else if (int15 == 92) {
                        s3 = "5";
                    }
                    else if (int15 == 93) {
                        s3 = "6";
                    }
                    else if (int15 == 75) {
                        s3 = "7";
                    }
                    else if (int15 == 76) {
                        s3 = "8";
                    }
                    else if (int15 == 77) {
                        s3 = "9";
                    }
                    else {
                        s3 = "";
                    }
                    if (s3 != null && !s3.equals("")) {
                        this.keyboardInterface.number(s3);
                        return;
                    }
                }
                if (int15 == 61) {
                    this.sendSerialPort(Cmd.OPEN_MANY);
                }
                else if (int15 == 62) {
                    this.sendSerialPort(Cmd.OPEN_MANY);
                }
                final KeyboardToolsInterface keyboardToolsInterface = this.keyboardToolsInterface;
                if (keyboardToolsInterface != null) {
                    if (int15 == 27) {
                        keyboardToolsInterface.turnPage();
                    }
                    else if (int15 == 28) {
                        keyboardToolsInterface.pluOrUp();
                    }
                    else if (int15 == 29) {
                        keyboardToolsInterface.setOrReturn();
                    }
                    else if (int15 == 30) {
                        keyboardToolsInterface.repeatPrint();
                    }
                    else if (int15 == 43) {
                        keyboardToolsInterface.paperOrLeft();
                    }
                    else if (int15 == 44) {
                        keyboardToolsInterface.timeOrDown();
                    }
                    else if (int15 == 45) {
                        keyboardToolsInterface.lockPriceOrRight();
                    }
                    else if (int15 == 46) {
                        keyboardToolsInterface.priceUpdata();
                    }
                    else if (int15 == 59) {
                        keyboardToolsInterface.communicationOrPassword();
                    }
                    else if (int15 == 60) {
                        keyboardToolsInterface.discount();
                    }
                    else if (int15 == 61) {
                        keyboardToolsInterface.peel();
                        this.sendSerialPort(Cmd.OPEN_MANY);
                    }
                    else if (int15 == 62) {
                        keyboardToolsInterface.zeroSetting();
                        this.sendSerialPort(Cmd.OPEN_MANY);
                    }
                    else if (int15 == 78) {
                        keyboardToolsInterface.X();
                    }
                    else if (int15 == 94) {
                        keyboardToolsInterface.cancel();
                    }
                    else if (int15 == 110) {
                        keyboardToolsInterface.automaticPrint();
                    }
                    else if (int15 == 125) {
                        keyboardToolsInterface.print();
                    }
                    else if (int15 == 126) {
                        keyboardToolsInterface.confirm();
                    }
                }
            }
        }
        if (s.indexOf("DE04EB") == 0) {
            System.out.println(s);
            final StringBuilder sb8 = new StringBuilder();
            sb8.append("\u952e\u76d8\u6570\u636e --> ");
            sb8.append(s);
            LogUtils.d(sb8.toString());
        }
        if (this.keyboardsInterface != null && s.indexOf("DE04EB") == 0) {
            if (s.equals("DE04EB01800000B0DF")) {
                this.keyboardsInterface.vaues("\u4f1a\u5458\u5361");
                return;
            }
            if (s.equals("DE04EB0108000038DF")) {
                this.keyboardsInterface.vaues("\u5fae\u4fe1");
                return;
            }
            if (s.equals("DE04EB0104000034DF")) {
                this.keyboardsInterface.vaues("\u652f\u4ed8\u5b9d");
                return;
            }
            if (s.equals("DE04EB0102000032DF")) {
                this.keyboardsInterface.vaues("\u73b0\u91d1");
                return;
            }
            if (s.equals("DE04EB0101000031DF")) {
                this.keyboardsInterface.vaues("\u6253\u5370");
                return;
            }
            if (s.equals("DE04EB02800000B3DF")) {
                this.keyboardsInterface.vaues("0");
                return;
            }
            if (s.equals("DE04EB020800003BDF")) {
                this.keyboardsInterface.vaues("00");
                return;
            }
            if (s.equals("DE04EB0204000037DF")) {
                this.keyboardsInterface.vaues("\u53d6\u6d88");
                return;
            }
            if (s.equals("DE04EB0202000031DF")) {
                this.keyboardsInterface.vaues("\u7d2f\u8ba1");
                return;
            }
            if (s.equals("DE04EB0201000032DF")) {
                this.keyboardsInterface.vaues("\u7d2f\u6e05");
                return;
            }
            if (s.equals("DE04EB04800000B5DF")) {
                this.keyboardsInterface.vaues("1");
                return;
            }
            if (s.equals("DE04EB040800003DDF")) {
                this.keyboardsInterface.vaues("2");
                return;
            }
            if (s.equals("DE04EB0404000031DF")) {
                this.keyboardsInterface.vaues("3");
                return;
            }
            if (s.equals("DE04EB0402000037DF")) {
                this.keyboardsInterface.vaues("PLU");
                return;
            }
            if (s.equals("DE04EB0401000034DF")) {
                this.keyboardsInterface.vaues("\u5176\u4ed6");
                return;
            }
            if (s.equals("DE04EB40800000F1DF")) {
                this.keyboardsInterface.vaues("4");
                return;
            }
            if (s.equals("DE04EB4008000079DF")) {
                this.keyboardsInterface.vaues("5");
                return;
            }
            if (s.equals("DE04EB4004000075DF")) {
                this.keyboardsInterface.vaues("6");
                return;
            }
            if (s.equals("DE04EB4002000073DF")) {
                this.keyboardsInterface.vaues("X");
                return;
            }
            if (s.equals("DE04EB4001000070DF")) {
                this.keyboardsInterface.vaues("\u7f6e\u96f6");
                return;
            }
            if (s.equals("DE04EB2080000091DF")) {
                this.keyboardsInterface.vaues("7");
                return;
            }
            if (s.equals("DE04EB2008000019DF")) {
                this.keyboardsInterface.vaues("8");
                return;
            }
            if (s.equals("DE04EB2004000015DF")) {
                this.keyboardsInterface.vaues("9");
                return;
            }
            if (s.equals("DE04EB2002000013DF")) {
                this.keyboardsInterface.vaues("\u8fd4\u56de");
                return;
            }
            if (s.equals("DE04EB2001000010DF")) {
                this.keyboardsInterface.vaues("\u53bb\u76ae");
                return;
            }
            if (s.equals("DE04EB1000000120DF")) {
                this.keyboardsInterface.vaues("+A");
                return;
            }
            if (s.equals("DE04EB1000000223DF")) {
                this.keyboardsInterface.vaues("+B");
                return;
            }
            if (s.equals("DE04EB1000000425DF")) {
                this.keyboardsInterface.vaues("+C");
                return;
            }
            if (s.equals("DE04EB1000000829DF")) {
                this.keyboardsInterface.vaues("+D");
                return;
            }
            if (s.equals("DE04EB1000001031DF")) {
                this.keyboardsInterface.vaues("\u8bbe\u7f6e");
                return;
            }
            if (s.equals("DE04EB10800000A1DF")) {
                this.keyboardsInterface.vaues("1");
                return;
            }
            if (s.equals("DE04EB1040000061DF")) {
                this.keyboardsInterface.vaues("2");
                return;
            }
            if (s.equals("DE04EB1020000001DF")) {
                this.keyboardsInterface.vaues("3");
                return;
            }
            if (s.equals("DE04EB1010000031DF")) {
                this.keyboardsInterface.vaues("4");
                return;
            }
            if (s.equals("DE04EB1000010020DF")) {
                this.keyboardsInterface.vaues("5");
                return;
            }
            if (s.equals("DE04EB1000020023DF")) {
                this.keyboardsInterface.vaues("6");
                return;
            }
            if (s.equals("DE04EB1000040025DF")) {
                this.keyboardsInterface.vaues("7");
                return;
            }
            if (s.equals("DE04EB1000080029DF")) {
                this.keyboardsInterface.vaues("8");
                return;
            }
            if (s.equals("DE04EB1000200001DF")) {
                this.keyboardsInterface.vaues("9");
                return;
            }
            if (s.equals("DE04EB2080000091DF")) {
                this.keyboardsInterface.vaues("10");
                return;
            }
            if (s.equals("DE04EB2040000051DF")) {
                this.keyboardsInterface.vaues("a");
                return;
            }
            if (s.equals("DE04EB2020000031DF")) {
                this.keyboardsInterface.vaues("b");
                return;
            }
            if (s.equals("DE04EB2010000001DF")) {
                this.keyboardsInterface.vaues("c");
                return;
            }
            if (s.equals("DE04EB2000010010DF")) {
                this.keyboardsInterface.vaues("d");
                return;
            }
            if (s.equals("DE04EB2000200031DF")) {
                this.keyboardsInterface.vaues("e");
                return;
            }
            if (s.equals("DE04EB2000080019DF")) {
                this.keyboardsInterface.vaues("f");
                return;
            }
            if (s.equals("DE04EB2000040015DF")) {
                this.keyboardsInterface.vaues("g");
                return;
            }
            if (s.equals("DE04EB2000020013DF")) {
                this.keyboardsInterface.vaues("h");
                return;
            }
            if (s.equals("DE04EB4040000031DF")) {
                this.keyboardsInterface.vaues("i");
                return;
            }
            if (s.equals("DE04EB4020000051DF")) {
                this.keyboardsInterface.vaues("j");
                return;
            }
            if (s.equals("DE04EB4010000061DF")) {
                this.keyboardsInterface.vaues("k");
                return;
            }
            if (s.equals("DE04EB4000010070DF")) {
                this.keyboardsInterface.vaues("l");
                return;
            }
            if (s.equals("DE04EB4000200051DF")) {
                this.keyboardsInterface.vaues("m");
                return;
            }
            if (s.equals("DE04EB4000080079DF")) {
                this.keyboardsInterface.vaues("n");
                return;
            }
            if (s.equals("DE04EB4000040075DF")) {
                this.keyboardsInterface.vaues("o");
                return;
            }
            if (s.equals("DE04EB4000020073DF")) {
                this.keyboardsInterface.vaues("p");
                return;
            }
            if (s.equals("DE04EB0200010032DF")) {
                this.keyboardsInterface.vaues("28");
                return;
            }
            if (s.equals("DE04EB0440000075DF")) {
                this.keyboardsInterface.vaues("29");
                return;
            }
            if (s.equals("DE04EB0440000075DF")) {
                this.keyboardsInterface.vaues("q");
                return;
            }
            if (s.equals("DE04EB0420000015DF")) {
                this.keyboardsInterface.vaues("r");
                return;
            }
            if (s.equals("DE04EB0410000025DF")) {
                this.keyboardsInterface.vaues("s");
                return;
            }
            if (s.equals("DE04EB0400010034DF")) {
                this.keyboardsInterface.vaues("t");
                return;
            }
            if (s.equals("DE04EB0400200015DF")) {
                this.keyboardsInterface.vaues("u");
                return;
            }
            if (s.equals("DE04EB040008003DDF")) {
                this.keyboardsInterface.vaues("v");
                return;
            }
            if (s.equals("DE04EB0400040031DF")) {
                this.keyboardsInterface.vaues("w");
                return;
            }
            if ("DE04EB0400020037DF".equals(s)) {
                this.keyboardsInterface.vaues("x");
                return;
            }
            if (s.equals("DE04EB02800000B3DF")) {
                this.keyboardsInterface.vaues("37");
                return;
            }
            if (s.equals("DE04EB0240000073DF")) {
                this.keyboardsInterface.vaues("y");
                return;
            }
            if (s.equals("DE04EB0220000013DF")) {
                this.keyboardsInterface.vaues("z");
                return;
            }
            if (s.equals("DE04EB0210000023DF")) {
                this.keyboardsInterface.vaues("27");
                return;
            }
            if (s.equals("DE04EB0200020031DF")) {
                this.keyboardsInterface.vaues("28");
                return;
            }
            if (s.equals("DE04EB0200200013DF")) {
                this.keyboardsInterface.vaues("29");
                return;
            }
            if (s.equals("DE04EB020008003BDF")) {
                this.keyboardsInterface.vaues("30");
                return;
            }
            if (s.equals("DE04EB0200040037DF")) {
                this.keyboardsInterface.vaues("31");
                return;
            }
            if (s.equals("DE04EB0200020031DF")) {
                this.keyboardsInterface.vaues("32");
                return;
            }
            if (s.equals("DE04EBFF4000008EDF")) {
                this.keyboardsInterface.vaues("48");
                return;
            }
            if (s.equals("DE04EBFF200000EEDF")) {
                this.keyboardsInterface.vaues("49");
                return;
            }
            if (s.equals("DE04EBFF100000DEDF")) {
                this.keyboardsInterface.vaues("50");
                return;
            }
            if (s.equals("DE04EBFF000100CFDF")) {
                this.keyboardsInterface.vaues("51");
                return;
            }
            if (s.equals("DE04EBFF002000EEDF")) {
                this.keyboardsInterface.vaues("52");
                return;
            }
            if (s.equals("DE04EBFF000800C6DF")) {
                this.keyboardsInterface.vaues("53");
                return;
            }
            if (s.equals("DE04EBFF000400CADF")) {
                this.keyboardsInterface.vaues("54");
                return;
            }
            if (s.equals("DE04EBFF000200CCDF")) {
                this.keyboardsInterface.vaues("55");
                return;
            }
            if (s.equals("DE04EB0140000070DF")) {
                this.keyboardsInterface.vaues("33");
                return;
            }
            if (s.equals("DE04EB0120000010DF")) {
                this.keyboardsInterface.vaues("34");
                return;
            }
            if (s.equals("DE04EB0110000020DF")) {
                this.keyboardsInterface.vaues("35");
                return;
            }
            if (s.equals("DE04EB0100010031DF")) {
                this.keyboardsInterface.vaues("36");
                return;
            }
            if (s.equals("DE04EB0100200010DF")) {
                this.keyboardsInterface.vaues("37");
                return;
            }
            if (s.equals("DE04EB0100080038DF")) {
                this.keyboardsInterface.vaues("38");
                return;
            }
            if (s.equals("DE04EB0100040034DF")) {
                this.keyboardsInterface.vaues("39");
                return;
            }
            if (s.equals("DE04EB0100020032DF")) {
                this.keyboardsInterface.vaues("40");
                return;
            }
            if (s.equals("DE04EB0100100020DF")) {
                this.keyboardsInterface.vaues("DE04EB0100100020DF");
            }
        }
    }
    
    public void analysisDataOutNew(final String s) {
        final int index = s.indexOf("DE16F8");
        int i = 0;
        if (index == 0 && s.length() >= 42) {
            if (this.weightInterface == null) {
                return;
            }
            final String replace = s.replace("DE16F8", "");
            if (replace.length() >= 24) {
                final String substring = replace.substring(0, 2);
                final String substring2 = replace.substring(2, 4);
                final String substring3 = replace.substring(4, 6);
                final String substring4 = replace.substring(6, 8);
                final String substring5 = replace.substring(8, 10);
                final double double1 = Double.parseDouble(substring4);
                final double double2 = Double.parseDouble(substring3);
                final double double3 = Double.parseDouble(substring2);
                final double double4 = Double.parseDouble(substring);
                final int int1 = Integer.parseInt(substring5);
                String string = "";
                double n = double1 * 1000000.0 + double2 * 10000.0 + double3 * 100.0 + double4;
                while (i < int1) {
                    n /= 10.0;
                    final StringBuilder sb = new StringBuilder();
                    sb.append(string);
                    sb.append("0");
                    string = sb.toString();
                    ++i;
                }
                final StringBuilder sb2 = new StringBuilder();
                sb2.append("######0.");
                sb2.append(string);
                final DecimalFormat decimalFormat = new DecimalFormat(sb2.toString());
                final String format = decimalFormat.format(n);
                double n2 = Double.parseDouble(replace.substring(18, 20)) * 1000000.0 + Double.parseDouble(replace.substring(16, 18)) * 10000.0 + Double.parseDouble(replace.substring(14, 16)) * 100.0 + Double.parseDouble(replace.substring(12, 14));
                for (int j = 0; j < int1; ++j) {
                    n2 /= 10.0;
                }
                this.weightInterface.skinWeight(decimalFormat.format(n2));
                final String substring6 = replace.substring(20, 22);
                final String substring7 = replace.substring(22, 24);
                final String substring8 = replace.substring(24, 26);
                final int int2 = Integer.parseInt(replace.substring(26, 28));
                final int int3 = Integer.parseInt(substring8);
                final int int4 = Integer.parseInt(substring7);
                final int int5 = Integer.parseInt(substring6);
                final WeightInterface weightInterface = this.weightInterface;
                final StringBuilder sb3 = new StringBuilder();
                sb3.append(int2 * 1000000 + int3 * 10000 + int4 * 100 + int5);
                sb3.append("");
                weightInterface.start_ad(sb3.toString());
                final String substring9 = replace.substring(28, 30);
                final String substring10 = replace.substring(30, 32);
                final String substring11 = replace.substring(32, 34);
                final int int6 = Integer.parseInt(replace.substring(34, 36));
                final int int7 = Integer.parseInt(substring11);
                final int int8 = Integer.parseInt(substring10);
                final int int9 = Integer.parseInt(substring9);
                final WeightInterface weightInterface2 = this.weightInterface;
                final StringBuilder sb4 = new StringBuilder();
                sb4.append(int6 * 1000000 + int7 * 10000 + int8 * 100 + int9);
                sb4.append("");
                weightInterface2.skinWeight_ad(sb4.toString());
                final String substring12 = replace.substring(36, 38);
                final String substring13 = replace.substring(38, 40);
                final String substring14 = replace.substring(40, 42);
                final int int10 = Integer.parseInt(replace.substring(42, 44));
                final int int11 = Integer.parseInt(substring14);
                final int int12 = Integer.parseInt(substring13);
                final int int13 = Integer.parseInt(substring12);
                final WeightInterface weightInterface3 = this.weightInterface;
                final StringBuilder sb5 = new StringBuilder();
                sb5.append(int10 * 1000000 + int11 * 10000 + int12 * 100 + int13);
                sb5.append("");
                weightInterface3.curent_ad(sb5.toString());
                final int int14 = Integer.parseInt(replace.substring(10, 12), 16);
                String string2 = "";
                for (int k = 7; k >= 0; --k) {
                    final StringBuilder sb6 = new StringBuilder();
                    sb6.append(string2);
                    sb6.append(int14 >> k & 0x1);
                    string2 = sb6.toString();
                }
                if (string2.length() == 8) {
                    final String substring15 = string2.substring(7, 8);
                    final String s2 = "1";
                    if (s2.equals(substring15)) {
                        this.weightInterface.stabilityWeight(1);
                    }
                    else {
                        this.weightInterface.stabilityWeight(0);
                    }
                    if (s2.equals(string2.substring(6, 7))) {
                        this.weightInterface.overload(1);
                    }
                    else {
                        this.weightInterface.overload(0);
                    }
                    if (s2.equals(string2.substring(5, 6))) {
                        this.weightInterface.loadBearing(1);
                        final WeightInterface weightInterface4 = this.weightInterface;
                        final StringBuilder sb7 = new StringBuilder();
                        sb7.append("-");
                        sb7.append(format);
                        weightInterface4.weight(sb7.toString());
                    }
                    else {
                        this.weightInterface.loadBearing(0);
                        this.weightInterface.weight(format);
                    }
                    if (s2.equals(string2.substring(4, 5))) {
                        this.weightInterface.peel(1);
                    }
                    else {
                        this.weightInterface.peel(0);
                    }
                    if (s2.equals(string2.substring(3, 4))) {
                        this.weightInterface.zeroPosition(1);
                    }
                    else {
                        this.weightInterface.zeroPosition(0);
                    }
                    if (s2.equals(string2.substring(2, 3))) {
                        this.weightInterface.error(1);
                    }
                    else {
                        this.weightInterface.error(0);
                    }
                    if (s2.equals(string2.substring(1, 2))) {
                        this.weightInterface.range(1);
                    }
                    else {
                        this.weightInterface.range(0);
                    }
                }
            }
        }
        if (s.equals("DE02E001003DDF")) {
            final CaliBrationInterface caliBrationInterface = this.caliBrationInterface;
            if (caliBrationInterface != null) {
                caliBrationInterface.start_step(0);
            }
        }
        else if (s.equals("DE02E000003CDF")) {
            final CaliBrationInterface caliBrationInterface2 = this.caliBrationInterface;
            if (caliBrationInterface2 != null) {
                caliBrationInterface2.start_step(1);
            }
        }
        else if (s.equals("DE02E006003ADF")) {
            final CaliBrationInterface caliBrationInterface3 = this.caliBrationInterface;
            if (caliBrationInterface3 != null) {
                caliBrationInterface3.start_step(2);
            }
        }
        else if (s.equals("DE02E000003CDF")) {
            final CaliBrationInterface caliBrationInterface4 = this.caliBrationInterface;
            if (caliBrationInterface4 != null) {
                caliBrationInterface4.start_step(3);
            }
        }
        else if (s.equals("DE02E002003EDF")) {
            final CaliBrationInterface caliBrationInterface5 = this.caliBrationInterface;
            if (caliBrationInterface5 != null) {
                caliBrationInterface5.start_step(4);
            }
        }
        else if (s.equals("DE02E003003FDF")) {
            final CaliBrationInterface caliBrationInterface6 = this.caliBrationInterface;
            if (caliBrationInterface6 != null) {
                caliBrationInterface6.start_step(5);
            }
        }
        else if (s.indexOf("DE10E004") == 0) {
            final CaliBrationInterface caliBrationInterface7 = this.caliBrationInterface;
            if (caliBrationInterface7 != null) {
                caliBrationInterface7.start_step(7);
            }
        }
        else if (s.equals("7E02E90000957F")) {
            final CaliBrationInterface caliBrationInterface8 = this.caliBrationInterface;
            if (caliBrationInterface8 != null) {
                caliBrationInterface8.start_step(11);
            }
        }
        else if (s.equals("DE02E003003FDF")) {
            final CaliBrationInterface caliBrationInterface9 = this.caliBrationInterface;
            if (caliBrationInterface9 != null) {
                caliBrationInterface9.start_step(12);
            }
        }
        if (s.length() >= 24) {
            final String substring16 = s.substring(18, 20);
            if (s.indexOf("DE07EB") == 0 && substring16.equals("DC")) {
                final int int15 = Integer.parseInt(s.replace("DE07EB", "").substring(10, 12), 16);
                final KeyboardInterface keyboardInterface = this.keyboardInterface;
                if (keyboardInterface != null) {
                    int n3;
                    if (int15 >= 16 && int15 <= 26) {
                        n3 = int15 - 15;
                    }
                    else if (int15 >= 32 && int15 <= 42) {
                        n3 = int15 - 20;
                    }
                    else if (int15 >= 48 && int15 <= 58) {
                        n3 = int15 - 25;
                    }
                    else if (int15 >= 64 && int15 <= 74) {
                        n3 = int15 - 30;
                    }
                    else if (int15 >= 80 && int15 <= 90) {
                        n3 = int15 - 35;
                    }
                    else if (int15 >= 96 && int15 <= 106) {
                        n3 = int15 - 40;
                    }
                    else if (int15 >= 112 && int15 <= 122) {
                        n3 = int15 - 45;
                    }
                    else {
                        n3 = 0;
                    }
                    if (n3 > 0) {
                        keyboardInterface.numberleans(n3);
                        return;
                    }
                }
                if (keyboardInterface != null) {
                    String s3;
                    if (int15 == 123) {
                        s3 = "0";
                    }
                    else if (int15 == 124) {
                        s3 = "00";
                    }
                    else if (int15 == 107) {
                        s3 = "1";
                    }
                    else if (int15 == 108) {
                        s3 = "2";
                    }
                    else if (int15 == 109) {
                        s3 = "3";
                    }
                    else if (int15 == 91) {
                        s3 = "4";
                    }
                    else if (int15 == 92) {
                        s3 = "5";
                    }
                    else if (int15 == 93) {
                        s3 = "6";
                    }
                    else if (int15 == 75) {
                        s3 = "7";
                    }
                    else if (int15 == 76) {
                        s3 = "8";
                    }
                    else if (int15 == 77) {
                        s3 = "9";
                    }
                    else {
                        s3 = "";
                    }
                    if (s3 != null && !s3.equals("")) {
                        this.keyboardInterface.number(s3);
                        return;
                    }
                }
                if (int15 == 61) {
                    this.sendSerialPort(Cmd.OPEN_MANY);
                }
                else if (int15 == 62) {
                    this.sendSerialPort(Cmd.OPEN_MANY);
                }
                final KeyboardToolsInterface keyboardToolsInterface = this.keyboardToolsInterface;
                if (keyboardToolsInterface != null) {
                    if (int15 == 27) {
                        keyboardToolsInterface.turnPage();
                    }
                    else if (int15 == 28) {
                        keyboardToolsInterface.pluOrUp();
                    }
                    else if (int15 == 29) {
                        keyboardToolsInterface.setOrReturn();
                    }
                    else if (int15 == 30) {
                        keyboardToolsInterface.repeatPrint();
                    }
                    else if (int15 == 43) {
                        keyboardToolsInterface.paperOrLeft();
                    }
                    else if (int15 == 44) {
                        keyboardToolsInterface.timeOrDown();
                    }
                    else if (int15 == 45) {
                        keyboardToolsInterface.lockPriceOrRight();
                    }
                    else if (int15 == 46) {
                        keyboardToolsInterface.priceUpdata();
                    }
                    else if (int15 == 59) {
                        keyboardToolsInterface.communicationOrPassword();
                    }
                    else if (int15 == 60) {
                        keyboardToolsInterface.discount();
                    }
                    else if (int15 == 61) {
                        keyboardToolsInterface.peel();
                        this.sendSerialPort(Cmd.OPEN_MANY);
                    }
                    else if (int15 == 62) {
                        keyboardToolsInterface.zeroSetting();
                        this.sendSerialPort(Cmd.OPEN_MANY);
                    }
                    else if (int15 == 78) {
                        keyboardToolsInterface.X();
                    }
                    else if (int15 == 94) {
                        keyboardToolsInterface.cancel();
                    }
                    else if (int15 == 110) {
                        keyboardToolsInterface.automaticPrint();
                    }
                    else if (int15 == 125) {
                        keyboardToolsInterface.print();
                    }
                    else if (int15 == 126) {
                        keyboardToolsInterface.confirm();
                    }
                }
            }
        }
        if (s.indexOf("DE04EB") == 0) {
            System.out.println(s);
            final StringBuilder sb8 = new StringBuilder();
            sb8.append("\u952e\u76d8\u6570\u636e --> ");
            sb8.append(s);
            LogUtils.d(sb8.toString());
        }
        if (this.keyboardsInterface != null && s.indexOf("DE04EB") == 0) {
            if (s.equals("DE04EB01800000B0DF")) {
                this.keyboardsInterface.vaues("\u4f1a\u5458\u5361");
                return;
            }
            if (s.equals("DE04EB0108000038DF")) {
                this.keyboardsInterface.vaues("\u6570\u5b57\u4eba\u6c11\u5e01");
                return;
            }
            if (s.equals("DE04EB0104000034DF")) {
                this.keyboardsInterface.vaues("\u652f\u4ed8\u5b9d");
                return;
            }
            if (s.equals("DE04EB0102000032DF")) {
                this.keyboardsInterface.vaues("\u73b0\u91d1");
                return;
            }
            if (s.equals("DE04EB0101000031DF")) {
                this.keyboardsInterface.vaues("\u786e\u8ba4");
                return;
            }
            if (s.equals("DE04EB02800000B3DF")) {
                this.keyboardsInterface.vaues("0");
                return;
            }
            if (s.equals("DE04EB020800003BDF")) {
                this.keyboardsInterface.vaues("00");
                return;
            }
            if (s.equals("DE04EB0204000037DF")) {
                this.keyboardsInterface.vaues("\u53d6\u6d88");
                return;
            }
            if (s.equals("DE04EB0202000031DF")) {
                this.keyboardsInterface.vaues("\u6253\u5370");
                return;
            }
            if (s.equals("DE04EB0201000032DF")) {
                this.keyboardsInterface.vaues("\u7d2f\u8ba1");
                return;
            }
            if (s.equals("DE04EB04800000B5DF")) {
                this.keyboardsInterface.vaues("1");
                return;
            }
            if (s.equals("DE04EB040800003DDF")) {
                this.keyboardsInterface.vaues("2");
                return;
            }
            if (s.equals("DE04EB0404000031DF")) {
                this.keyboardsInterface.vaues("3");
                return;
            }
            if (s.equals("DE04EB0402000037DF")) {
                this.keyboardsInterface.vaues("\u5176\u4ed6");
                return;
            }
            if (s.equals("DE04EB0401000034DF")) {
                this.keyboardsInterface.vaues("\u7d2f\u6e05");
                return;
            }
            if (s.equals("DE04EB40800000F1DF")) {
                this.keyboardsInterface.vaues("4");
                return;
            }
            if (s.equals("DE04EB4008000079DF")) {
                this.keyboardsInterface.vaues("5");
                return;
            }
            if (s.equals("DE04EB4004000075DF")) {
                this.keyboardsInterface.vaues("6");
                return;
            }
            if (s.equals("DE04EB4002000073DF")) {
                this.keyboardsInterface.vaues("X");
                return;
            }
            if (s.equals("DE04EB4001000070DF")) {
                this.keyboardsInterface.vaues("\u7f6e\u96f6");
                return;
            }
            if (s.equals("DE04EB2080000091DF")) {
                this.keyboardsInterface.vaues("7");
                return;
            }
            if (s.equals("DE04EB2008000019DF")) {
                this.keyboardsInterface.vaues("8");
                return;
            }
            if (s.equals("DE04EB2004000015DF")) {
                this.keyboardsInterface.vaues("9");
                return;
            }
            if (s.equals("DE04EB2002000013DF")) {
                this.keyboardsInterface.vaues("\u8fd4\u56de");
                return;
            }
            if (s.equals("DE04EB2001000010DF")) {
                this.keyboardsInterface.vaues("\u53bb\u76ae");
                return;
            }
            if (s.equals("DE04EB1000000120DF")) {
                this.keyboardsInterface.vaues("+A");
                return;
            }
            if (s.equals("DE04EB1000000223DF")) {
                this.keyboardsInterface.vaues("+B");
                return;
            }
            if (s.equals("DE04EB1000000425DF")) {
                this.keyboardsInterface.vaues("+C");
                return;
            }
            if (s.equals("DE04EB1000000829DF")) {
                this.keyboardsInterface.vaues("+D");
                return;
            }
            if (s.equals("DE04EB1000001031DF")) {
                this.keyboardsInterface.vaues("\u8bbe\u7f6e");
                return;
            }
            if (s.equals("DE04EB10800000A1DF")) {
                this.keyboardsInterface.vaues("1");
                return;
            }
            if (s.equals("DE04EB1040000061DF")) {
                this.keyboardsInterface.vaues("2");
                return;
            }
            if (s.equals("DE04EB1020000001DF")) {
                this.keyboardsInterface.vaues("3");
                return;
            }
            if (s.equals("DE04EB1010000031DF")) {
                this.keyboardsInterface.vaues("4");
                return;
            }
            if (s.equals("DE04EB1000010020DF")) {
                this.keyboardsInterface.vaues("5");
                return;
            }
            if (s.equals("DE04EB1000020023DF")) {
                this.keyboardsInterface.vaues("6");
                return;
            }
            if (s.equals("DE04EB1000040025DF")) {
                this.keyboardsInterface.vaues("7");
                return;
            }
            if (s.equals("DE04EB1000080029DF")) {
                this.keyboardsInterface.vaues("8");
                return;
            }
            if (s.equals("DE04EB1000200001DF")) {
                this.keyboardsInterface.vaues("9");
                return;
            }
            if (s.equals("DE04EB2080000091DF")) {
                this.keyboardsInterface.vaues("10");
                return;
            }
            if (s.equals("DE04EB2040000051DF")) {
                this.keyboardsInterface.vaues("a");
                return;
            }
            if (s.equals("DE04EB2020000031DF")) {
                this.keyboardsInterface.vaues("b");
                return;
            }
            if (s.equals("DE04EB2010000001DF")) {
                this.keyboardsInterface.vaues("c");
                return;
            }
            if (s.equals("DE04EB2000010010DF")) {
                this.keyboardsInterface.vaues("d");
                return;
            }
            if (s.equals("DE04EB2000200031DF")) {
                this.keyboardsInterface.vaues("e");
                return;
            }
            if (s.equals("DE04EB2000080019DF")) {
                this.keyboardsInterface.vaues("f");
                return;
            }
            if (s.equals("DE04EB2000040015DF")) {
                this.keyboardsInterface.vaues("g");
                return;
            }
            if (s.equals("DE04EB2000020013DF")) {
                this.keyboardsInterface.vaues("h");
                return;
            }
            if (s.equals("DE04EB4040000031DF")) {
                this.keyboardsInterface.vaues("i");
                return;
            }
            if (s.equals("DE04EB4020000051DF")) {
                this.keyboardsInterface.vaues("j");
                return;
            }
            if (s.equals("DE04EB4010000061DF")) {
                this.keyboardsInterface.vaues("k");
                return;
            }
            if (s.equals("DE04EB4000010070DF")) {
                this.keyboardsInterface.vaues("l");
                return;
            }
            if (s.equals("DE04EB4000200051DF")) {
                this.keyboardsInterface.vaues("m");
                return;
            }
            if (s.equals("DE04EB4000080079DF")) {
                this.keyboardsInterface.vaues("n");
                return;
            }
            if (s.equals("DE04EB4000040075DF")) {
                this.keyboardsInterface.vaues("o");
                return;
            }
            if (s.equals("DE04EB4000020073DF")) {
                this.keyboardsInterface.vaues("p");
                return;
            }
            if (s.equals("DE04EB0200010032DF")) {
                this.keyboardsInterface.vaues("28");
                return;
            }
            if (s.equals("DE04EB0440000075DF")) {
                this.keyboardsInterface.vaues("29");
                return;
            }
            if (s.equals("DE04EB0440000075DF")) {
                this.keyboardsInterface.vaues("q");
                return;
            }
            if (s.equals("DE04EB0420000015DF")) {
                this.keyboardsInterface.vaues("r");
                return;
            }
            if (s.equals("DE04EB0410000025DF")) {
                this.keyboardsInterface.vaues("s");
                return;
            }
            if (s.equals("DE04EB0400010034DF")) {
                this.keyboardsInterface.vaues("t");
                return;
            }
            if (s.equals("DE04EB0400200015DF")) {
                this.keyboardsInterface.vaues("u");
                return;
            }
            if (s.equals("DE04EB040008003DDF")) {
                this.keyboardsInterface.vaues("v");
                return;
            }
            if (s.equals("DE04EB0400040031DF")) {
                this.keyboardsInterface.vaues("w");
                return;
            }
            if ("DE04EB0400020037DF".equals(s)) {
                this.keyboardsInterface.vaues("x");
                return;
            }
            if (s.equals("DE04EB02800000B3DF")) {
                this.keyboardsInterface.vaues("37");
                return;
            }
            if (s.equals("DE04EB0240000073DF")) {
                this.keyboardsInterface.vaues("y");
                return;
            }
            if (s.equals("DE04EB0220000013DF")) {
                this.keyboardsInterface.vaues("z");
                return;
            }
            if (s.equals("DE04EB0210000023DF")) {
                this.keyboardsInterface.vaues("27");
                return;
            }
            if (s.equals("DE04EB0200020031DF")) {
                this.keyboardsInterface.vaues("28");
                return;
            }
            if (s.equals("DE04EB0200200013DF")) {
                this.keyboardsInterface.vaues("29");
                return;
            }
            if (s.equals("DE04EB020008003BDF")) {
                this.keyboardsInterface.vaues("30");
                return;
            }
            if (s.equals("DE04EB0200040037DF")) {
                this.keyboardsInterface.vaues("31");
                return;
            }
            if (s.equals("DE04EB0200020031DF")) {
                this.keyboardsInterface.vaues("32");
                return;
            }
            if (s.equals("DE04EBFF4000008EDF")) {
                this.keyboardsInterface.vaues("48");
                return;
            }
            if (s.equals("DE04EBFF200000EEDF")) {
                this.keyboardsInterface.vaues("49");
                return;
            }
            if (s.equals("DE04EBFF100000DEDF")) {
                this.keyboardsInterface.vaues("50");
                return;
            }
            if (s.equals("DE04EBFF000100CFDF")) {
                this.keyboardsInterface.vaues("51");
                return;
            }
            if (s.equals("DE04EBFF002000EEDF")) {
                this.keyboardsInterface.vaues("52");
                return;
            }
            if (s.equals("DE04EBFF000800C6DF")) {
                this.keyboardsInterface.vaues("53");
                return;
            }
            if (s.equals("DE04EBFF000400CADF")) {
                this.keyboardsInterface.vaues("54");
                return;
            }
            if (s.equals("DE04EBFF000200CCDF")) {
                this.keyboardsInterface.vaues("55");
                return;
            }
            if (s.equals("DE04EB0140000070DF")) {
                this.keyboardsInterface.vaues("33");
                return;
            }
            if (s.equals("DE04EB0120000010DF")) {
                this.keyboardsInterface.vaues("34");
                return;
            }
            if (s.equals("DE04EB0110000020DF")) {
                this.keyboardsInterface.vaues("35");
                return;
            }
            if (s.equals("DE04EB0100010031DF")) {
                this.keyboardsInterface.vaues("36");
                return;
            }
            if (s.equals("DE04EB0100200010DF")) {
                this.keyboardsInterface.vaues("37");
                return;
            }
            if (s.equals("DE04EB0100080038DF")) {
                this.keyboardsInterface.vaues("38");
                return;
            }
            if (s.equals("DE04EB0100040034DF")) {
                this.keyboardsInterface.vaues("39");
                return;
            }
            if (s.equals("DE04EB0100020032DF")) {
                this.keyboardsInterface.vaues("40");
                return;
            }
            if (s.equals("DE04EB0100100020DF")) {
                this.keyboardsInterface.vaues("DE04EB0100100020DF");
            }
        }
    }
    
    public void closeSerialPort() {
        Log.i("test", "\u5173\u95ed\u4e32\u53e3");
        try {
            final InputStream inputStream = this.inputStream;
            if (inputStream != null) {
                inputStream.close();
            }
            final OutputStream outputStream = this.outputStream;
            if (outputStream != null) {
                outputStream.close();
            }
            this.isStart = false;
        }
        catch (IOException ex) {
            ex.printStackTrace();
        }
    }
    
    public InputStream getInputStream() {
        if (this.inputStream == null) {
            this.inputStream = this.getSerialPort().getInputStream();
        }
        return this.inputStream;
    }
    
    public SerialPort getSerialPort() {
        if (this.serialPort == null) {
            try {
                this.serialPort = new SerialPort(new File("/dev/ttyS1"), 115200, 0);
            }
            catch (IOException ex) {
                ex.printStackTrace();
            }
        }
        return this.serialPort;
    }
    
    public SerialPort getSerialPort(final String s, final int n) {
        if (this.serialPort == null) {
            try {
                this.serialPort = new SerialPort(new File(s), n, 0);
            }
            catch (IOException ex) {
                ex.printStackTrace();
            }
        }
        return this.serialPort;
    }
    
    public void openSerialPort() {
        try {
            final SerialPort serialPort = new SerialPort(new File("/dev/ttyS1"), 115200, 0);
            this.serialPort = serialPort;
            this.inputStream = serialPort.getInputStream();
            this.outputStream = this.serialPort.getOutputStream();
            this.isStart = true;
        }
        catch (IOException ex) {
            ex.printStackTrace();
        }
        this.startThread();
    }
    
    public void sendSerialPort(final String s) {
        try {
            this.outputStream.write(DataUtils.HexToByteArr(s));
            this.outputStream.flush();
        }
        catch (IOException ex) {
            ex.printStackTrace();
        }
    }
    
    public void sendSerialPort(final byte[] array) {
        try {
            this.outputStream.write(array);
            this.outputStream.flush();
        }
        catch (IOException ex) {
            ex.printStackTrace();
        }
    }
    
    public void setCaliBrationInterface(final CaliBrationInterface caliBrationInterface) {
        this.caliBrationInterface = caliBrationInterface;
    }
    
    public void setContext(final Context context) {
        this.context = context;
    }
    
    public void setKeyboardInterface(final KeyboardInterface keyboardInterface) {
        this.keyboardInterface = keyboardInterface;
        if (SerialPortUtil.serialPortUtil == null) {
            SerialPortUtil.serialPortUtil = new SerialPortUtil();
        }
    }
    
    public void setKeyboardToolsInterface(final KeyboardToolsInterface keyboardToolsInterface) {
        this.keyboardToolsInterface = keyboardToolsInterface;
        if (SerialPortUtil.serialPortUtil == null) {
            SerialPortUtil.serialPortUtil = new SerialPortUtil();
        }
    }
    
    public void setKeyboardsInterface(final KeyboardsInterface keyboardsInterface) {
        this.keyboardsInterface = keyboardsInterface;
    }
    
    public SerialPort setSerialPort(final String s, final int n) {
        try {
            final SerialPort serialPort = new SerialPort(new File(s), n, 0);
            this.serialPort = serialPort;
            this.inputStream = serialPort.getInputStream();
            this.outputStream = this.serialPort.getOutputStream();
            this.isStart = true;
            this.startThread();
        }
        catch (IOException ex) {
            ex.printStackTrace();
        }
        return this.serialPort;
    }
    
    public void setWeightInterface(final WeightInterface weightInterface) {
        this.weightInterface = weightInterface;
        if (SerialPortUtil.serialPortUtil == null) {
            SerialPortUtil.serialPortUtil = new SerialPortUtil();
        }
    }
    
    public interface CaliBrationInterface
    {
        void start_step(final int p0);
    }
    
    public interface KeyboardInterface
    {
        void number(final String p0);
        
        void numberleans(final int p0);
    }
    
    public interface KeyboardToolsInterface
    {
        void X();
        
        void automaticPrint();
        
        void cancel();
        
        void communicationOrPassword();
        
        void confirm();
        
        void discount();
        
        void lockPriceOrRight();
        
        void paperOrLeft();
        
        void peel();
        
        void pluOrUp();
        
        void priceUpdata();
        
        void print();
        
        void repeatPrint();
        
        void setOrReturn();
        
        void timeOrDown();
        
        void turnPage();
        
        void zeroSetting();
    }
    
    public interface KeyboardsInterface
    {
        void vaues(final String p0);
    }
    
    private class ReceiveThread extends Thread
    {
        @Override
        public void run() {
            super.run();
            String substring = "";
            while (SerialPortUtil.this.isStart) {
                if (SerialPortUtil.this.inputStream == null) {
                    return;
                }
                final byte[] array = new byte[1024];
                String replaceFirst = substring;
                try {
                    final int read = SerialPortUtil.this.inputStream.read(array);
                    if (read <= 0) {
                        continue;
                    }
                    replaceFirst = substring;
                    final String byteArrToHex = DataUtils.ByteArrToHex(array, 0, read);
                    replaceFirst = substring;
                    final StringBuilder sb = new StringBuilder();
                    replaceFirst = substring;
                    sb.append("\u79f0\u91cd\u6570\u636e");
                    replaceFirst = substring;
                    sb.append(byteArrToHex);
                    replaceFirst = substring;
                    Log.e("test", sb.toString());
                    if (byteArrToHex == null) {
                        continue;
                    }
                    replaceFirst = substring;
                    if (byteArrToHex.equals("")) {
                        continue;
                    }
                    replaceFirst = substring;
                    final StringBuilder sb2 = new StringBuilder();
                    replaceFirst = substring;
                    sb2.append(substring);
                    replaceFirst = substring;
                    sb2.append(byteArrToHex);
                    replaceFirst = substring;
                    String string = sb2.toString();
                    while (true) {
                        replaceFirst = string;
                        if (string.indexOf("DE") == -1) {
                            break;
                        }
                        replaceFirst = string;
                        if (string.indexOf("DF") == -1) {
                            break;
                        }
                        replaceFirst = string;
                        if (string.indexOf("DE") >= string.indexOf("DF")) {
                            break;
                        }
                        replaceFirst = string;
                        final String substring2 = string.substring(string.indexOf("DE"), string.indexOf("DF") + 2);
                        replaceFirst = string;
                        string = (replaceFirst = string.replaceFirst(substring2, ""));
                        Observable.create((ObservableOnSubscribe<Object>)new ObservableOnSubscribe() {
                            @Override
                            public void subscribe(final ObservableEmitter observableEmitter) {
                                try {
                                    final int deviceStyle = SerialPortUtil.this.deviceStyle;
                                    if (deviceStyle == 0) {
                                        SerialPortUtil.this.analysisDataNew(substring2);
                                        return;
                                    }
                                    if (deviceStyle != 1) {
                                        return;
                                    }
                                    SerialPortUtil.this.analysisDataOutNew(substring2);
                                }
                                catch (Exception ex) {}
                            }
                        }).observeOn(AndroidSchedulers.mainThread()).subscribeOn(AndroidSchedulers.mainThread()).subscribe();
                    }
                    substring = string;
                    replaceFirst = string;
                    if (string.indexOf("DE") <= 0) {
                        continue;
                    }
                    replaceFirst = string;
                    substring = string.substring(string.indexOf("DE"), string.length());
                }
                catch (Exception ex) {
                    ex.printStackTrace();
                    substring = replaceFirst;
                }
            }
        }
    }
    
    public interface WeightInterface
    {
        void curent_ad(final String p0);
        
        void error(final int p0);
        
        void loadBearing(final int p0);
        
        void overload(final int p0);
        
        void peel(final int p0);
        
        void range(final int p0);
        
        void skinWeight(final String p0);
        
        void skinWeight_ad(final String p0);
        
        void stabilityWeight(final int p0);
        
        void start_ad(final String p0);
        
        void weight(final String p0);
        
        void zeroPosition(final int p0);
    }
}
